ASP.NET Button ValidationGroupProperty
Button Control
Definition and Usage
The ValidationGroup property specifies the group of controls to be validated when the Button control posts back to the server.
This property is typically used when there are multiple buttons in a form.
Syntax
<asp:Button ValidationGroup="group" runat="server" />
| Property | Description |
|---|---|
| ValidationGroup | The control group to be validated. |
Example
Example
The following example validates a specific validation group:
<asp:textbox id="tb1" runat=Server />
<asp:requiredfieldvalidator id="ReqField1" controltovalidate="tb1"
validationgroup="valGroup1" ErrorMessage="Required" runat="server" />
<asp:button id="Button2" text="Validate" causesvalidation="True"
validationgroup="valGroup2" runat="server" />
<asp:requiredfieldvalidator id="ReqField1" controltovalidate="tb1"
validationgroup="valGroup1" ErrorMessage="Required" runat="server" />
<asp:button id="Button2" text="Validate" causesvalidation="True"
validationgroup="valGroup2" runat="server" />
Show Example »
Button Control Other Extensions