How do you get the response from message box?


I have a confirm message box that displays "yes" or "no", If a user clicks "yes", do something, but for some reasons I can't get the message response from the message box in the code behind.  Can anyone shows me how to get the response from the message box?  Thanks

 Here is the code that display the confirm message box:

btnClick.Attributes.Add("onclick", "return confirm('Are you sure you proceed?');");

11/24/2008 6:58:41 PM 91979 articles. 4 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 36
Get it on Google Play
Get it on Apple App Store

 You can use below. If yes is clicked it will go further.

btnClick.Attributes.Add("onclick", "if(confirm('Are you sure you proceed?')){}else{return false;}")

Don't forget to click on 'Answered' button, if my post is helpful:)
11/24/2008 7:29:57 PM

Thanks Praveen for replying,

 Is there a way to keep track of the message box of been active or not in the control event?  I have a confirm message code in the "btnClick_Click" event and when I click the "Click" button, it fires the "btnClick_Click" event, then, show the message box. If I click "yes" in the message box, it goes in the control event again. I want to add the if and else statement right after the confirm message box calls, if yes is clicked, then go into the if loop.  How do I check the response from the message box?

11/24/2008 9:14:54 PM