<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>带有验证功能的会员注册</title>
    <style type="text/css">
        .style1
        {
            width: 114px;
        }
        .style2
        {
            width: 133px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center" >
    
        <table align="center" style="width: 408px;" border="0">
            <tr>
                <td align="center"  colspan="3" bgcolor="#FFFFCC" 
                    style="font-size: x-large; color: #FF0000; font-weight: bold;" >       
                   带有验证功能的会员注册</td>
            </tr>
                  <tr>
                <td align="center"  colspan="3" >
                    --------------------------------------------------------</td>
            </tr>

            <tr>
                <td class="style1">
                    姓名：</td>
                <td class="style2">
                    <asp:TextBox ID="TextBox1" runat="server" Width="135px"></asp:TextBox>
                </td>
                    <td>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="TextBox1" ErrorMessage="姓名不能为空！">姓名不能为空！</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    性别：</td>
                <td class="style2">
                    <asp:DropDownList ID="DropDownList1" runat="server" Height="16px" Width="135px">
                        <asp:ListItem>男</asp:ListItem>
                        <asp:ListItem>女</asp:ListItem>
                    </asp:DropDownList>
                </td>
                    <td>
                        &nbsp;</td>
            </tr>
                 <tr>
                <td class="style1">
                    密码：</td>
                <td class="style2">
                    <asp:TextBox ID="TextBox2" runat="server" TextMode="Password" Width="135px"></asp:TextBox>
                     </td>
                    <td>
                        &nbsp;</td>
            </tr>
            
               <tr>
                <td class="style1">
                    重复密码：</td>
                <td class="style2">
                    <asp:TextBox ID="TextBox3" runat="server" TextMode="Password" Width="135px"></asp:TextBox>
                   </td>
                    <td>
                        <asp:CompareValidator ID="CompareValidator1" runat="server" 
                            ControlToCompare="TextBox2" ControlToValidate="TextBox3" 
                            ErrorMessage="输入的密码不一致！">输入的密码不一致！</asp:CompareValidator>
                   </td>
            </tr>
                <tr>
                <td class="style1">
                    真实姓名：</td>
                <td class="style2">
                    <asp:TextBox ID="TextBox4" runat="server" Width="135px"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;</td>
            </tr>
               <tr>
                <td class="style1">
                    年龄：</td>
                <td class="style2">
                    <asp:TextBox ID="TextBox5" runat="server" Width="135px"></asp:TextBox>
                   </td>
                    <td>
                        <asp:RangeValidator ID="RangeValidator1" runat="server" 
                            ControlToValidate="TextBox5" ErrorMessage="输入的年龄必须在16到36岁之间！" MaximumValue="36" 
                            MinimumValue="16">输入的年龄必须在16到36岁之间！</asp:RangeValidator>
                   </td>
            </tr>
           <tr>
                <td class="style1">
                    身份证：</td>
                <td class="style2">
                    <asp:TextBox ID="TextBox6" runat="server" Width="135px"></asp:TextBox>
                </td>
                    <td>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                            ControlToValidate="TextBox6" ErrorMessage="输入的身份证号不正确！" 
                            ValidationExpression="\d{17}[\d|X]|\d{15}">输入的身份证号不正确！</asp:RegularExpressionValidator>
                </td>
            </tr>
           <tr>
                <td class="style1">
                    所在城市：</td>
                <td class="style2">
                    <asp:DropDownList ID="DropDownList2" runat="server" Font-Size="9pt" 
                        Height="16px" Width="135px">
                        <asp:ListItem>长春市</asp:ListItem>
                        <asp:ListItem>长治市</asp:ListItem>
                        <asp:ListItem>北京市</asp:ListItem>
                        <asp:ListItem>上海市</asp:ListItem>
                        <asp:ListItem>天津市</asp:ListItem>
                        <asp:ListItem>吉林市</asp:ListItem>
                        <asp:ListItem>乌鲁木齐</asp:ListItem>
                        <asp:ListItem>呼和浩特</asp:ListItem>
                        <asp:ListItem>银川</asp:ListItem>
                        <asp:ListItem>拉萨</asp:ListItem>
                        <asp:ListItem>五台山</asp:ListItem>
                        <asp:ListItem>太行山</asp:ListItem>
                        <asp:ListItem>吐鲁番</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr> 
           <tr>
                <td class="style1">
                    电子邮件：</td>
                <td class="style2">
                    <asp:TextBox ID="TextBox7" runat="server" Width="135px"></asp:TextBox>
                </td>
                    <td>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                            ControlToValidate="TextBox7" ErrorMessage="输入的电子邮件格式不正确！" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">输入的电子邮件格式不正确！</asp:RegularExpressionValidator>
                </td>
            </tr>  
            
                   <tr>
                <td align="center"  colspan="3" >
                    <asp:Button ID="Button1" runat="server" Text="  注  册  " 
                        onclick="Button1_Click" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="Button2" runat="server" Text="  重  填  " 
                        onclick="Button2_Click" />
                    </td>
            </tr>  
            
        </table>
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" 
            ShowSummary="False" />
    </div>
    
    </form>
</body>
</html>
