Back to Devexpress

ValidationSettings.ValidationGroup Property

aspnet-devexpress-dot-web-dot-validationsettings-05dd6b16.md

latest5.8 KB
Original Source

ValidationSettings.ValidationGroup Property

Gets or sets the name of a validation group to which the editor belongs.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue("")]
public string ValidationGroup { get; set; }
vb
<DefaultValue("")>
Public Property ValidationGroup As String

Property Value

TypeDefaultDescription
StringString.Empty

A string value that specifies the name of a validation group.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to ValidationGroup
ASPxEdit

.ValidationSettings .ValidationGroup

| | EditProperties |

.ValidationSettings .ValidationGroup

|

Remarks

Validation 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 ValidationGroup property to specify the name of the validation group for the current editor.

When the ValidationSettings.CausesValidation property is set to true, the ValidationGroup property specifies a validation group that is validated when the editor posts back to the server. If you do not specify a value for this property and the ValidationSettings.CausesValidation property is set to true, all validation controls on the page that are not assigned to a validation group are validated when the editor posts back to the server.

In order to validate a group of input controls on the client, you can use the following client methods: ASPxClientEdit.ValidateGroup, ASPxClientEdit.ValidateEditorsInContainer, ASPxClientEdit.ValidateEditorsInContainerById.

Online Example

View Example: How to raise validation on the client

Example

View Example

aspx
<dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" Width="200px" View="GroupBox" HeaderText="ValidationGroup = 'MyGroup'">
    <PanelCollection>
        <dx:PanelContent ID="PanelContent1" runat="server">  
            <dx:ASPxTextBox ID="tbTextBox3" runat="server" Width="170px" Style="margin-bottom: 4px;">
                <ValidationSettings ValidationGroup="MyGroup" ErrorText="Field is required." validateonleave="False">
                    <RequiredField IsRequired="True" ErrorText="" />
                </ValidationSettings>
            </dx:ASPxTextBox>
            <dx:ASPxTextBox ID="tbTextBox4" runat="server" Width="170px">
                <ValidationSettings ValidationGroup="MyGroup" ErrorText="Field is required." validateonleave="False">
                    <RequiredField IsRequired="True" ErrorText="" />
                </ValidationSettings>
            </dx:ASPxTextBox>
            

            <input type="button" value="Validate Group" onclick="ASPxClientEdit.ValidateGroup('MyGroup');" />
        </dx:PanelContent>
    </PanelCollection>
    <HeaderStyle Font-Size="9pt" />
</dx:ASPxRoundPanel>
aspx
<dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" Width="200px" View="GroupBox" HeaderText="ValidationGroup = 'MyGroup'">
    <PanelCollection>
        <dx:PanelContent ID="PanelContent1" runat="server">  
            <dx:ASPxTextBox ID="tbTextBox3" runat="server" Width="170px" Style="margin-bottom: 4px;">
                <ValidationSettings ValidationGroup="MyGroup" ErrorText="Field is required." validateonleave="False">
                    <RequiredField IsRequired="True" ErrorText="" />
                </ValidationSettings>
            </dx:ASPxTextBox>
            <dx:ASPxTextBox ID="tbTextBox4" runat="server" Width="170px">
                <ValidationSettings ValidationGroup="MyGroup" ErrorText="Field is required." validateonleave="False">
                    <RequiredField IsRequired="True" ErrorText="" />
                </ValidationSettings>
            </dx:ASPxTextBox>
            

            <input type="button" value="Validate Group" onclick="ASPxClientEdit.ValidateGroup('MyGroup');" />
        </dx:PanelContent>
    </PanelCollection>
    <HeaderStyle Font-Size="9pt" />
</dx:ASPxRoundPanel>

See Also

How to: Validate a Group of Editors

Validation

ValidationSettings Class

ValidationSettings Members

DevExpress.Web Namespace