ASP.NET ValidationGroupProperty


ListControl 控件参考手册ListControl Control Reference Manual

Definition and Usage

The ValidationGroup property specifies the group of controls that are validated during validation.

This property is usually used when there are several buttons in a form.

Syntax

<asp:SomeListControl ValidationGroup="group" runat="server" />

Property Description
group The group of controls to be validated.


Example

The following example validates the specified group of controls:

<form runat="server">
<asp:RadioButtonList id="rb1"
ValidationGroup="valGroup1" runat="server">
  <asp:ListItem Value="Item 1" />
  <asp:ListItem Value="Item 2" />
</asp:RadioButtonList>

<asp:RequiredFieldValidator id="ReqField1"
ControlToValidate="rb1" ErrorMessage="Required"
ValidationGroup="ValGroup1" runat="server" />
<asp:Button id="Bt1" Text="Validate"
CausesValidation="True" ValidationGroup="ValGroup1"
runat="server" />
</form>

Demo Example »

ListControl 控件参考手册ListControl Control Reference Manual Other Extensions