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
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):
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.