BaseValidator.SetFocusOnError 属性

定义

获取或设置一个值,该值指示在验证失败时是否将焦点设置到 ControlToValidate 属性指定的控件上。Gets or sets a value that indicates whether focus is set to the control specified by the ControlToValidate property when validation fails.

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

属性值

Boolean

如果在验证失败时将焦点设置到 ControlToValidate 指定的控件上,则为 true;否则为 falsetrue to set focus on the control specified by ControlToValidate when validation fails; otherwise, false. 默认值为 falseThe default is false.

属性

注解

使用 SetFocusOnError 属性指定 ControlToValidate 当此验证控件失败时焦点是否自动设置为属性指定的控件。Use the SetFocusOnError property to specify whether focus is automatically set to the control specified by the ControlToValidate property when this validation control fails. 这样,用户就可以快速更新相应的控件。This allows the user to quickly update the appropriate control.

如果多个验证控件失败并且此属性设置为 true ,则 ControlToValidate 第一个验证控件在属性中指定的控件接收焦点。If multiple validation controls fail and this property is set to true, the control specified in the ControlToValidate property for the first validation control receives focus.

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

适用于

另请参阅