CheckBox.CausesValidation 属性

定义

获取或设置一个值,该值指示当选中 CheckBox 控件时是否执行验证。Gets or sets a value indicating whether validation is performed when the CheckBox control is selected.

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

属性值

Boolean

如果在单击 CheckBox 时执行验证,则为 true;否则为 falsetrue if validation is performed when the CheckBox is clicked; otherwise, false. 默认值为 falseThe default is false.

属性

注解

使用 CausesValidation 属性可确定在选择控件时是否同时在客户端和服务器上执行验证 CheckBoxUse the CausesValidation property to determine whether validation is performed on both the client and the server when a CheckBox control is selected. 页验证确定与页上的验证控件关联的输入控件是否都通过验证控件指定的验证规则。Page validation determines whether the input controls that are associated with a validation control on the page all pass the validation rules as specified by the validation control.

默认情况下,单击 CheckBox 控件不会导致页验证。By default, clicking a CheckBox control does not cause page validation. 若要在单击控件时执行页验证 CheckBox ,请将 CausesValidation 属性设置为 trueTo perform page validation when the CheckBox control is clicked, set the CausesValidation property to true.

当属性的值 CausesValidation 设置为时 true ,还可以使用 ValidationGroup 属性来指定该控件对其进行验证的验证组的名称 CheckBoxWhen the value of the CausesValidation property is set to true, you can also use the ValidationGroup property to specify the name of the validation group for which the CheckBox control causes validation.

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

适用于

另请参阅