Dear All,
In my asp.net website iam using infragistics controls 9.1 V.
My website is a rich social network that offers users many web forms to fill. For example, users can post articles and edit lengthy profiles. Often they click on a link that takes them away from the page or press the wrong key (e.g. backspace that navigates to the previous page). In both cases their changes get lost. And it is always frustrating to have to re-enter the same text twice. Wouldn't it be nice to warn the user that he has unsaved data and give him an opportunity to cancel, then save his data?
Please suggest a solution to solve this issue.
Thanks in advance,
Regards,
Vasanth.
Vasanth,
Internet Explorer provides the ability to handle the onbeforeunload event of the BODY element to give the user a chance to cancel navigating away from the current page. You'll need to determine whether something on the page has been "dirtied" to determine if you want to put up this warning dialog.
I'm not myself aware of a similar approach that can be used with other browsers, such as Firefox.
Methods to determine whether something has been "dirtied" will differ from control to control. This can be as simple as setting a page-level boolean variable to false, and flipping it to true in the onvaluechange of every textbox on the page where it mattres for your application's needs. For Infragistics controls, you'll want to use their client-side events for an otherwise-similar approach