aspnet-devexpress-dot-web-dot-aspxbutton-ba533aa9.md
Gets or sets the group of controls for which the button control causes validation.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
[DefaultValue("")]
public string ValidationGroup { get; set; }
<DefaultValue("")>
Public Property ValidationGroup As String
| Type | Default | Description |
|---|---|---|
| String | String.Empty |
A string value that specifies the group of controls for which the button control causes validation.
|
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.
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.
<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>
See Also
ValidateGroup(validationGroup)