I have an asp.net web page...and it has following script on the HTML <script> block
var needToConfirm = <%= jsNeedToConfirm.ToString().ToLower() %>;
window.onbeforeunload = confirmExit;
if (needToConfirm )
and in the code behind(im using C#) on the page_load event the variable
bool jsNeedToConfirm = true;
everything looks good till now....BUT...i have an asp.net button and in the click event of that button im setting jsNeedToConfirm = false;....now the problem im facing is that when im clicking the Save button....even before the click event is called the alert window is being popped up...and then its going to Click event of the button and setting the jsNeedToConfirm = false......can any one tell me what can be the problem or anyother suggestions.....
Prompt help on this wud be much appreciated...