Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
Handle unsaved data
posted

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.

  • 45049
    Suggested Answer
    posted

    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