I am new to ASP.net and I wanted to add a confirmation popup to my webpage. I tried using the following code snippet, inspired by a similar one found here: http://www.codeproject.com/Articles/8173/A-Simple-ASP-NET-Server-Control-Message-Box-Confir.
insert unique code here...
In testing this code from a test class, I expected that upon clicking a button, a confirmation popup would appear asking me to confirm:
If I click "no": a postback would occur and MoreCode() would not be executed.
If I click "yes": no additional JavaScript should execute, allowing MoreCode() to proceed.
However, when running through the debugger, I observed that:
The confirm2 function is executed before moreCode()
MoreCode() runs before the popup appears.
This order of execution puzzled me. Can someone explain why this happens?
Thank you in advance.