ASP.NET HTML 控件 Validationsummary

asp.net html 控件 validationsummary

<!doctype html>
<html>
<body>

<form runat="server">
<table>
<tr>
<td>
<table bgcolor="#b0c4de" cellspacing="10">
   <tr>
     <td align="right">name:</td>
     <td><asp:textbox id="txt_name" runat="server"/></td>
     <td>
     <asp:requiredfieldvalidator
     controltovalidate="txt_name" 
     errormessage="name"
     text="*" 
     runat="server"/>
     </td>
   </tr>
   <tr>
     <td align="right">card type:</td>
     <td>
     <asp:radiobuttonlist id="rlist_type" 
     repeatlayout="flow"
     runat="server">
     <asp:listitem>diners</asp:listitem>
     <asp:listitem>mastercard</asp:listitem>
     <asp:listitem>visa</asp:listitem>
     </asp:radiobuttonlist>
     </td>
     <td>
     <asp:requiredfieldvalidator
     controltovalidate="rlist_type"
     errormessage="card type"
     initialvalue=""
     text="*"
     runat="server"/>
     </td>
   </tr>
   <tr>
     <td></td>
     <td><asp:button id="b1" text="submit" runat="server"/></td>
     <td></td>
   </tr>
</table>
</td>
</tr>
</table>
<br>
<asp:validationsummary
headertext="you must enter a value in the following fields:"
displaymode="bulletlist"
enableclientscript="true"
runat="server"/>
</form>

</body>
</html>
相关文章