Skip to main content
A newer version of this page is available. .
Tab

ASPxButton.ValidationGroup Property

Gets or sets the group of controls for which the button control causes validation.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue("")]
public string ValidationGroup { get; set; }

Property Value

Type Default Description
String String.Empty

A string value that specifies the group of controls for which the button control causes validation.

Remarks

Validation groups allow you to assign validation controls on a page to a specific category. Each validation group can be validated independently from other validation groups on the page. Use the ValidationGroup property to specify the name of the validation group for which the button forces validation when it is clicked.

This property has effect only when the ASPxButton.CausesValidation property is set to true. When you specify a value for the ValidationGroup property, only the validation controls that are part of the specified group are validated when the button is clicked. If you do not specify a value for this property and the ASPxButton.CausesValidation property is set to true, all verifiable controls on the page that are not assigned to a validation group are validated when the button is clicked.

The functionality of the ValidationGroup property is affected by whether or not the ASPxButton.ValidationContainerID property is assigned. The possible cases of synergy between these two properties are listed below.

  • If only the ValidationGroup property is assigned, all controls belonging to the specified validation group are validated.
  • If only the ValidationContainerID property is assigned, all controls in the specified container are validated except for controls with assigned validation groups.
  • If both properties are assigned, only controls belonging to the specified validation group are validated within the specified container.
  • If both properties are unassigned, all editors not belonging to any validation group are validated.

Note that a group of input controls can also be validated on the client by using the following client static methods: ASPxClientEdit.ValidateGroup, ASPxClientEdit.ValidateEditorsInContainer, ASPxClientEdit.ValidateEditorsInContainerById.

Example

<dx:ASPxTextBox ID="ASPxTextBox1" runat="server" Width="170px">
     <ValidationSettings ValidationGroup="MyGroup" ValidateOnLeave="False">
          <RequiredField IsRequired="True" ErrorText="Field is required" />
     </ValidationSettings>
</dx:ASPxTextBox>
<dx:ASPxTextBox ID="ASPxTextBox2" runat="server" Width="170px">
     <ValidationSettings ValidationGroup="MyGroup" ValidateOnLeave="False">
          <RequiredField IsRequired="True" ErrorText="Field is required" />
     </ValidationSettings>
</dx:ASPxTextBox>
<dx:ASPxButton ID="btn" runat="server" Text="Validate" AutoPostBack="False" ValidationGroup="MyGroup">
</dx:ASPxButton>

Implements

See Also