Change Theme Settings
Change Theme Settings
Show All Themes

Detecting Changes (Dirty Form)

Change one of the editors to make a form dirty. On an attempt to close the form, the onbeforeunload event will be executed and the "Confirm" dialog will be displayed.

Save Changes
Cancel Changes

This demo illustrates how to detect changes in a form and notify a user to save/cancel these changes before leaving the page.

For this, use the ASPxClientEdit.AttachEditorModificationListener method to attach a handler to the ASPxClientEdit's event which indicates whether a user modified the form's field values since the previous save. The new ASPxTextEdit.UserInput event allows tracking any changes within an editor.

After updating a form, the "Save Changes" and "Cancel Changes" buttons become available. When a user attempts to close the page without saving the changes, it raises the onbeforeunload event, and the "Confirm" dialog is shown.

Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
The source code files for this demo are installed (by default) in the following directory:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxDataEditorsDemos