0

suppose when user click on edit button, he should not be allowed to go any of hyperlinks or tabs or any other other page. after clicking save or close buttons he shold be allowed to move. even though if tries to click on any hyperlinks or tabs he shold get an alert message to make changes or not. just as MS-word if open blank document n click on close it will ask u for save. aspnet c# web application

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by hollystyles
0

You will need to set an onchange or onkeydown event in all of your editable controls to set a global dirty flag. Check this flag in the window.onbeforeunload event and simply return a string to it, the browser will do the rest.

<html>
<head>
<script type="text/javascript">
    var unsaved = false;
    window.onbeforeunload = function(){if(unsaved){return "You have unsaved data. Are you sure you wish to leave this page.";}};
</script>
</head>
<body>
<input type="text" id="txt1" onkeydown="unsaved = true;"/>
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.