Take the 2-minute tour ×

I'm developing an ASP.NET web application with AJAX.

I have a page where the user can edit some information: it has a list of item, the user select one item, click on Edit button and then edit item's name and item's description on two textboxes.

If user click on another item since he doesn't save his changes, he can click on edit button to edit this new item.

I want to check if there is some data on textboxes and ask to the user if he wants to lose their changes before loading the data of the new item.

How can I do that?

Thank you.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

There are four ways that I can think of to handle this:

  1. Always save the changes (auto save). We've eliminated almost all save buttons from forms and just always auto save the data based on user feedback.
  2. Always prompt to save changes; i.e. assume that if the form is in edit mode then there are changes.
  3. Hook every control's change event and toggle a boolean if any control fires its change event; prompt the user if it's true.
  4. The hardest (and arguably best) method is to actually compare the previous values to the current values and only prompt if they're different.

The method you select depends on the application and user expectations.

share|improve this answer
add comment

Your Answer


