Validation Settings

  • 2 minutes to read

To define editor validation logic, validation criteria can be specified via the following properties.

You can specify the particular error message for different validation criteria. To learn more, see the Validation Error Message.

The input focus can be automatically forced back to the editor's input region when editor validation fails. The ValidationSettings.SetFocusOnError property controls the change in input focus. This allows the user to quickly update the editor's invalid value.

Editor validation can start automatically after the editor value has been changed if the ValidationSettings.ValidateOnLeave property is set to true.

DevExpress editor's API provides the ability to work with a group of editors - validation group. Groups allow you to assign validation editors on a page to a specific category. Each validation group can be validated independently from other validation groups on the page. Use the ValidationSettings.ValidationGroup property to specify the name of the validation group for a particular editor.

An editor's validation can force a whole editor group validation if the editor's ValidationSettings.CausesValidation property is set to true.

Example

<dx:ASPxTextBox ID="tbEmail" runat="server">
     <ValidationSettings>
          <RequiredField ErrorText="E-mail is required" IsRequired="True" />
          <RegularExpression ErrorText="Invalid e-mail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
     </ValidationSettings>
</dx:ASPxTextBox>
See Also