<body>
<form id=
"form1" runat=
"server">
<table>
<tr runat=
"server">
<td>用戶名:</td>
<td><asp:TextBox runat=
"server" ID=
"username"></asp:TextBox></td>
<td>
<asp:RequiredFieldValidator ID=
"RequiredFieldValidator1" runat=
"server"
ControlToValidate=
"username" Display=
"Dynamic" ErrorMessage=
"請正確輸入用戶名"></asp:RequiredFieldValidator><!對用戶輸入的信息進行非空驗證,併爲動態顯示,如驗證不經過彈出」請輸入用戶名「>
</td>
</tr>
<tr>
<td>密碼:</td>
<td><asp:TextBox runat=
"server" ID=
"password1" TextMode=
"Password"></asp:TextBox> </td>
<td>
<asp:RequiredFieldValidator ID=
"RequiredFieldValidator2" runat=
"server"
ControlToValidate=
"password1" Display=
"Dynamic" ErrorMessage=
"請輸入密碼!"></asp:RequiredFieldValidator><!對密碼進行非空驗證,併爲動態顯示,錯誤時提示:請輸入密碼>
</td>
</tr>
<tr>
<td>密碼確認:</td>
<td><asp:TextBox runat=
"server" ID=
"password2" TextMode=
"Password"></asp:TextBox></td>
<td>
<asp:CompareValidator ID=
"CompareValidator1" runat=
"server"
ControlToCompare=
"password1" ControlToValidate=
"password2" Display=
"Dynamic"
ErrorMessage=
"請確認密碼正確性"></asp:CompareValidator><!這裏的controltocompare是對第一次輸入的密碼進行比較,測試十分保持一致>
</td>
</tr>
<tr>
<td>性別:</td>
<td>
<asp:RadioButton Text=
"男" ID=
"rd1" runat=
"server" GroupName=
"1" /><!groupname必須相同>
<asp:RadioButton Text=
"女" ID=
"rd2" runat=
"server" GroupName=
"1" />
</td>
<td></td>
</tr>
<tr>
<td>聯繫電話:</td>
<td><asp:TextBox runat=
"server" ID=
"telephone"></asp:TextBox></td><!正則表達式偶還沒學>
<td></td>
</tr>
<tr>
<td>興趣愛好:</td>
<td>
<asp:CheckBox runat=
"server" ID=
"cb1" Text=
"籃球" />
<asp:CheckBox runat=
"server" ID=
"cb2" Text=
"足球" />
<asp:CheckBox runat=
"server" ID=
"cb3" Text=
"排球" />
<asp:CheckBox runat=
"server" ID=
"cb4" Text=
"讀書" />
</td>
<td></td>
</tr>
<tr>
<td colspan=
"2" style=
"text-align: center">
<asp:Button ID=
"bt" runat=
"server"
Text=
"提交" onclick=
"bt_Click" />
</td>
<td></td>
</tr>
</table>
</form>
</body>