Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

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.


v
v
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.

Collapse/Expand
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
Open VB Solution
The source code files for this demo are installed (by default) in the following directories:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\ASPxEditorsDemos
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\VB\ASPxEditorsDemos