ASP.NET ValidationGroup Property
Definition and Usage
Gets or sets the control group to be validated when the Button control is posted back to the server.
This property is usually used when there are multiple buttons in a form.
Syntax
<asp:Button ValidationGroup="group" runat="server" />
Properties | Description |
---|---|
group | The control group to be validated. |
Example
The following example will validate 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" />
Example
- Set two different validation groups in the form