TextBox.ValidationGroup 属性

定义

获取或设置在 TextBox 控件回发到服务器时导致验证的控件组。Gets or sets the group of controls for which the TextBox control causes validation when it posts back to the server.

public:
 virtual property System::String ^ ValidationGroup { System::String ^ get(); void set(System::String ^ value); };
[System.Web.UI.Themeable(false)]
public virtual string ValidationGroup { get; set; }
[<System.Web.UI.Themeable(false)>]
member this.ValidationGroup : string with get, set
Public Overridable Property ValidationGroup As String

属性值

String

TextBox 控件回发到服务器时导致验证的控件组。The group of controls for which the TextBox control causes validation when it posts back to the server. 默认值为空字符串 ("")。The default value is an empty string ("").

属性

注解

使用验证组可以将页上的验证控件分配给特定类别。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. 使用 ValidationGroup 属性来指定在 TextBox 控件回发到服务器时,控件引发验证的验证组的名称。Use the ValidationGroup property to specify the name of the validation group for which the TextBox control causes validation when it posts back to the server.

仅当属性设置为时,此属性才有效 CausesValidation trueThis property has an effect only when the CausesValidation property is set to true. 如果为属性指定值,则 ValidationGroupTextBox 控件回发到服务器时,只会验证属于指定组的验证控件。When you specify a value for the ValidationGroup property, only the validation controls that are part of the specified group are validated when the TextBox control posts back to the server. 如果未指定此属性的值,并且 CausesValidation 属性设置为 true ,则当控件回发到服务器时,将验证该页上未分配给验证组的所有验证控件。If you do not specify a value for this property and the CausesValidation property is set to true, all validation controls on the page that are not assigned to a validation group are validated when the control posts back to the server.

无法通过主题或样式表主题设置此属性。This property cannot be set by themes or style sheet themes. 有关详细信息,请参阅 ThemeableAttributeASP.NET 主题和外观For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

适用于

另请参阅