Posted on: 3/7/2013 10:46:49 AM | Views : 210

I have a form that is implementing isDirty to check to see if there are any changes on the page, and to prompt the user to save if they navigate away from the page. 
Here is my Javascript:
<script type="text/javascript"> var isDirty; isDirty = 0; function setDirty() { isDirty = 1; } window.onbeforeunload = function checkSave() { var sSave; if (isDirty == 1) { sSave = window.confirm("You have some changes that have not been saved.\n Click OK to save now or CANCEL to continue without saving."); if (sSave == true) { if (document.getElementById("<% =cmdSave.ClientID%>") != null) { __doPostBack("<%= Page.ClientScript.GetPostBackEventReference(cmdSave, "")%>", ""); } ...

Go to the complete details ...