Link to home
Start Free TrialLog in
Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya

asked on

Popup message with Buttons in Java Script in C# programming

Hello Experts,
I am looking for Popup message in C# programming.  If certain condition is true, I need the message box with 2 Buttons (Cancel and Continue).  If Cancel is clicked, it should come back to the C# steps and continue execution from the next line of the code.  Otherwise, it should skip the rest of the routine.  

Is Java Scripts is a better solution?  If so, how to do it?  Also, please let me know if you have a better idea.  Thank you a lot in advance.

Example:
--------------
if (condition == ture)
{
    Display Message Box (with Cancel and Continue buttons)
    if (Continue is clicked)
    {
         Continue processing...
    }
    else
    {
         Skip processing...
    }
}
SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya

ASKER

Hello Ryan,
Thank you for your help.  The code you provided is a Button Click event.  I need exactly same thing, but inside the c# code.  Here is the example.

C# Code...
.
.
protected void btnUpdate_Click(object sender, EventArgs e)
{
      C# Code....
      .
      .
      if (condition == True)
      {
            Display Message Box (with Cancel and Continue buttons)
            if (Continue is clicked)
            {
                  Continue processing...
            }
            else
            {
                   Skip processing...
            }
      }
      else
      {
                   Skip processing...
       }
}
.
.
   private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Display Message", "Application Name", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
            {
             // do something here
                label1.Text = "You Pressed OK";
            }
        else {
                return  ;
                }

Open in new window

similarly, you can have a panel control in your page with Yes/ No buttons, when a button was clicked, show that panel accordingly.

Do you think that make sense to you?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank You very much.  Unfortunately I issue is not resolved yet.  But I have learned a lot from each of you.  Again, Thank You very much for your help.  I have no words for you guys.  That's why I asked the same question differently in the following string.  Please see if you can help.


https://www.experts-exchange.com/questions/28779159/Popup-message-with-Buttons-in-Java-Script-in-C-programming.html