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

Validation

*
Cannot be “admin”, cannot contain spaces
*
+
-
Must be between 18 and 100
E.g. +1 (789) 555-1234
*
Must be a valid email
Send
Clear


This demo illustrates how to use the Unobtrusive ASP.NET MVC validation approach to validate a user's input. To attach validation rules to input fields, add DataAnnotations attributes to model class properties. For example, the "CreditCardAttribute" validates a field value as a credit card number.

DevExpress MVC Data Editors provide a container for validation error messages. Use the ShowModelErrors property to specify whether data editors display error messages if validation fails. The ValidationSettings property allows you to control how errors are displayed.

Refer to the following online examples for information about other validation approaches:


See Also:
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
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