TextBox.CausesValidation TextBox.CausesValidation TextBox.CausesValidation TextBox.CausesValidation Property

定義

取得或設定值,表示當 TextBox 控制項設定為驗證回傳發生的時間時是否執行驗證。Gets or sets a value indicating whether validation is performed when the TextBox control is set to validate when a postback occurs.

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

屬性值

如果在 TextBox 控制項設定為驗證回傳發生的時間時執行驗證,則為 true,否則為 falsetrue if validation is performed when the TextBox control is set to validate when a postback occurs; otherwise, false. 預設值為 falseThe default value is false.

備註

使用屬性,即可判斷TextBox當控制項設定為驗證回傳發生的時間時,是否在用戶端和伺服器上執行驗證。 CausesValidationUse the CausesValidation property to determine whether validation is performed on both the client and the server when a TextBox control is set to validate when a postback occurs. 頁面驗證會判斷與頁面上的驗證控制項相關聯的輸入控制項是否都會通過驗證控制項所指定的驗證規則。Page validation determines whether the input controls associated with a validation control on the page all pass the validation rules specified by the validation control.

根據預設,當TextBox控制項失去焦點時,控制項不會造成頁面驗證。By default, a TextBox control does not cause page validation when the control loses focus. 若要設定TextBox控制項來驗證回傳發生的時間,請CausesValidation將屬性設true為, AutoPostBack並將true屬性設定為。To set the TextBox control to validate when a postback occurs, set the CausesValidation property to true and the AutoPostBack property to true.

CausesValidation屬性的值設定為true時, ValidationGroup您也可以使用屬性來指定TextBox控制項會導致驗證的驗證組名。When 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 TextBox control causes validation.

這個屬性無法由佈景主題或樣式表主題設定。This property cannot be set by themes or style sheet themes. 如需詳細資訊, ThemeableAttribute請參閱和ASP.NET 主題和外觀For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

適用於

另請參閱