The ASPxEditors Library provide a powerful and seamless way to perform data validation both on the client and server.
Different validation settings can be customized for an editor using specific properties available via the editor's
ValidationSettings property.
To define editor validation logic, the following easy-to-use means are provided (which can be combined together, if 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 event can be handled on either the client or server (or both) to setup editor validation.
Review the code sample tabs within this demo to learn how easy this really is.
In this demo the validation check is triggered by clicking on the 'OK' ASPxButton control or
by changing the editor's value (if the ValidationSettings.ValidateOnLeave
option is enabled).
When an editor fails validation logic, the following can be displayed:
-
Error image - To define an error image, use the ValidationSettings.ErrorImage property.
-
Error text - The text can be specified by using either the ValidationSettings.ErrorText property or in the Validation event's handler.
-
A specific error frame near the editor - The error frame's appearance is customized via the
ValidationSettings.ErrorFrameStyle property. You can also use the
ValidationSettings.Display property to control how the error frame
occupies its space around the editor.
-
Other similar settings can also be customized via the ValidationSettings property.
Input focus can be forced back to the editor's input region. The ValidationSettings.SetFocusOnError property controls the change in input focus.
This demo illustrates the built-in flexibility and efficiency of our validation engine, allowing you to easily implement different validation scenarios without using additional validator controls.