看来微软还是想到这东西了,哈哈
<%
@ 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 >
< 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 >