Check if any form fields have changed upon saving asp.net c# -


i've got large .net form hundreds of input fields, users navigate off form page without saving, what's best way check if field value has changed when try navigate away? c# function or javascript?

don't take control out of users hand :-)

ask him on exit, if wants save changes. maybe did changes mistake, don't want save.

you can achieve javascript/jquery. like:

$(document).ready(function() {     formmodified=0;     $('form *').change(function(){         formmodified=1;     });     window.onbeforeunload = confirmexit;     function confirmexit() {         if (formmodified == 1) {             return "new information not saved. wish leave page?";         }     }     $("input[name='commit']").click(function() {         formmodified = 0;     }); }); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -