TextBox.ValidationGroup TextBox.ValidationGroup TextBox.ValidationGroup TextBox.ValidationGroup Property

定義

取得或設定控制項群組,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; }
member this.ValidationGroup : string with get, set
Public Overridable Property ValidationGroup As 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. 使用屬性,即可指定TextBox控制項在回傳至伺服器時,會導致驗證的驗證組名。 ValidationGroupUse 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屬性設定為true時,這個屬性才會生效。This property has an effect only when the CausesValidation property is set to true. 當您指定ValidationGroup屬性的值時,只有屬於指定群組的驗證控制項會TextBox在控制項回傳至伺服器時進行驗證。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. 如需詳細資訊, ThemeableAttribute請參閱和ASP.NET 主題和外觀For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

適用於

另請參閱