只是在页面进行简单的验证。
<table >
<tr>
<td>
用户名称:<asp:TextBox ID="UserName" runat="server" Width ="150"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqiredUsername" runat="server" ErrorMessage="用户名称不能为空。" ControlToValidate="UserName" Display ="Dynamic" ></asp:RequiredFieldValidator>
<asp:RangeValidator ID="renge" runat ="server" ControlToValidate ="UserName" ErrorMessage ="必须是小写字母," MaximumValue ="z" MinimumValue ="a" Font-Bold ="true" ></asp:RangeValidator>
</td>
</tr>
<tr>
<td>
原始密码:<asp:TextBox ID="Password" runat ="server" Width ="150"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequPassword" runat ="server" ErrorMessage ="原始密码不能为空。" ControlToValidate ="Password" Display ="Dynamic" ></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
新 密 码:<asp:TextBox ID="NewPassword" runat ="server" Width ="150"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredNewPassword" runat ="server" ErrorMessage ="新密码不能为空。" ControlToValidate ="NewPassword" Display ="Dynamic" ></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
确认密码:<asp:TextBox ID="SurePassword" runat="server" Width ="150"> </asp:TextBox>
<asp:CompareValidator ID="comparePassword" runat ="server" ControlToValidate ="SurePassword" ControlToCompare ="NewPassword" ErrorMessage ="两次输入的密码不同。"></asp:CompareValidator>
</td>
</tr>
<tr>
<td align ="left">
<asp:Button ID ="SureBtnn" runat ="server" Text ="确定" Width ="150" />
</td>
</tr>
</table>