Back to Devexpress

Validation Settings

aspnet-11127-components-data-editors-common-concepts-validation-validation-settings.md

latest2.9 KB
Original Source

Validation Settings

  • Jun 27, 2024
  • 2 minutes to read

The following properties specify validation criteria to define editor validation logic:

You can specify an error message based on validation criteria. See the following help topic to learn more: Validation Error Message.

Set the ValidationSettings.SetFocusOnError property to true to automatically move the input focus back to the editor’s input region when editor validation fails. This allows the user to update the editor’s invalid value.

Editor validation can start automatically after a user changes an editor value if the ValidationSettings.ValidateOnLeave property is set to true.

A DevExpress editor’s API allows you to work with a group of editors - a 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 can validate an entire editor group if the editor’s ValidationSettings.CausesValidation property is set to true.

Example

aspx
<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

Online Demo: Inplace Validation

Validation

Validation Examples

Use regular expressions in Visual Studio

Regular Expression Language - Quick Reference