今天在crtl+c&ctrl+v中无意中发现TextBox居然有这样的属性ValidationGroup 看来微软还是想到这东西了,哈哈 <% @ Page Language = " C# " %> < html > < body > < form runat = " server " > < h3 > BaseValidator ValidationGroup Example </ h3 > Please enter your name: < br /> < asp:textbox id = " NameTextBox " runat = " server " /> < asp:requiredfieldvalidator id = " NameTextBoxRequiredValidator " controltovalidate = " NameTextBox " display = " Dynamic " text = " Please enter your name. " validationgroup = " UserInfoGroup " runat = " server " /> < br >< br > < asp:button id = " SubmitButton " text = " Submit " validationgroup = " UserInfoGroup " runat = " server " /> < hr /> Please enter a search topic: < br /> < asp:textbox id = " SearchTextBox " runat = " server " /> < asp:requiredfieldvalidator id = " SearchTextBoxRequiredValidator " controltovalidate = " SearchTextBox " display = " Dynamic " text = " Please enter a topic. " validationgroup = " SearchGroup " runat = " server " /> < br >< br > < asp:button id = " SearchButton " text = " Search " validationgroup = " SearchGroup " runat = " server " /> </ form > </ body > </ html > 转载于:https://www.cnblogs.com/Xuzq/archive/2007/01/24/628916.html