Hello,
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?');");
![]() |
0 |
![]() |
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:)
TechRoving
![]() |
0 |
![]() |
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?
![]() |
0 |
![]() |