Free Trial Buy Now

Data Editors - Built-in Validation

v
Update
Clear

The following validation rules are defined in this demo: Name: required, must be under 50 characters; Age: required, must be between 18 and 100; Email: required, must fit email regular expression; Arrival date: required

Description

This demo illustrates the built-in flexibility and efficiency of our MVC data validation engine, allowing you to easily implement different validation scenarios. Validation settings can be customized for a given editor by using the editor's Properties.ValidationSettings property.

To define editor validation logic, use the following (can be combined together whenever required):

  • The ValidationSettings.RequiredField property can be used to force an editor to require input and give you the ability to display an error message if input is not received.
  • The ValidationSettings.RegularExpression property allows you to validate an editor's value based upon a regular expression.
  • An editor's Validation client event can be handled to setup custom editor validation. Review the code sample tabs within this demo, to learn how easy this really is.

Editor validation is automatically triggered by changing the editor's value whenever the ValidationSettings.ValidateOnLeave option is enabled. You can manually initiate editor validation by using the editor's Validate client method or specific static client methods (such as the ASPxClientEdit.ValidateEditorsInContainer, ASPxClientEdit.ValidateEditorsInContainerById, ASPxClientEdit.ValidateGroup).

When an editor fails validation logic, a specific error frame containing the error’s description can be displayed. The ValidationSettings.Display property controls how the error frame occupies space around the editor. The error frame's appearance is customized via the ValidationSettings.ErrorFrameStyle property. Based upon ValidationSettings.ErrorDisplayMode settings, the description of an error can be represented within the error frame using an error image or text (or both). To define an error image, use the ValidationSettings.ErrorImage property. The error text can be specified by using either the ValidationSettings.ErrorText property or in the Validation event's handler.

Version: v2012 vol 2.8
Experience the DevExpress Difference Today
Demos with source code are included with an installation of DevExpress controls for ASP.NET. Refer to the Demos and Sample Applications topic to learn more.
To download your free evaluation copy of our award-winning ASP.NET libraries, visit the Downloads page
All DevExpress MVC Extensions ship as part of DXperience ASP.NET, Enterprise, and Universal.
To obtain pricing information, visit the Pricing Options page or contact us via Email at info@devexpress.com
or by telephone at +1 (818) 844-3383 between 8:30am and 5pm Pacific Time.