用户注册: 这里是用 4个Panel 的Visible属性来实现注册步骤.
首先看前台页面:
1<%@ Page Language="C#" AutoEventWireup="true" CodeFile="reg1.aspx.cs" Inherits="test_register_reg1" %>
2
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" >
6<head runat="server">
7 <title>无标题页</title>
8</head>
9<body>
10 <form id="form1" runat="server">
11 <div style="text-align: center">
12 <asp:Panel ID="Panel1" runat="server" BorderColor="#0000C0" BorderStyle="Dotted"
13 BorderWidth="1px" Height="221px" Width="631px">
14 <table style="height: 100%">
15 <tr>
16 <td style="font-weight: bold; font-size: 18pt; width: 635px; color: gold; height: 41px;
17 background-color: #9999ff">
18 用户注册</td>
19 </tr>
20 <tr>
21 <td align="left" style="width: 600px; height: 38px">
22 注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,</td>
23 </tr>
24 <tr>
25 <td style="width: 635px; height: 50px">
26 <asp:RadioButton ID="rBtnAgree" runat="server" GroupName="agree" Text="同意" />
27 <asp:RadioButton ID="rBtnNotAgree" runat="server" Checked="True" GroupName="agree"
28 Text="不同意" /></td>
29 </tr>
30 <tr>
31 <td style="width: 635px; height: 37px; background-color: silver">
32 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="下一步" /></td>
33 </tr>
34 </table>
35 </asp:Panel>
36 <asp:Panel ID="Panel2" runat="server" BorderColor="#0000C0" BorderStyle="Dotted"
37 BorderWidth="1px" Height="221px" Visible="False" Width="631px">
38 <table border="1" cellpadding="0" cellspacing="0" style="width: 622px">
39 <tr>
40 <td colspan="3" style="font-weight: bold; font-size: 18px; color: #ffff00; height: 46px;
41 background-color: #6699ff">
42 用户登录</td>
43 </tr>
44 <tr>
45 <td style="width: 174px; height: 35px; text-align: right">
46 用户名:</td>
47 <td colspan="2" style="height: 35px; text-align: left">
48 <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox><asp:RequiredFieldValidator
49 ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtUserName" Display="Dynamic"
50 ErrorMessage="用户名不能为空">*</asp:RequiredFieldValidator>
51 <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="txtUserName"
52 Display="Dynamic" ErrorMessage="用户名已经存在" OnServerValidate="CustomValidator1_ServerValidate">*</asp:CustomValidator></td>
53 </tr>
54 <tr>
55 <td style="width: 174px; height: 29px; text-align: right">
56 密码:</td>
57 <td colspan="2" style="height: 29px; text-align: left">
58 <asp:TextBox ID="txtUserPwd" runat="server"></asp:TextBox><asp:RequiredFieldValidator
59 ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtUserPwd" Display="Dynamic"
60 ErrorMessage="密码不能为空">*</asp:RequiredFieldValidator></td>
61 </tr>
62 <tr>
63 <td style="width: 174px; height: 29px; text-align: right">
64 确认密码:</td>
65 <td colspan="2" style="height: 29px; text-align: left">
66 <asp:TextBox ID="txtUserPwdAgain" runat="server"></asp:TextBox>
67 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtUserPwdAgain"
68 Display="Dynamic" ErrorMessage="确认密码不能为空">*</asp:RequiredFieldValidator>
69 <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtUserPwd"
70 ControlToValidate="txtUserPwdAgain" ErrorMessage="两次密码输入不相同">*</asp:CompareValidator></td>
71 </tr>
72 <tr>
73 <td colspan="3" style="height: 60px">
74 <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" />
75 <br />
76 <asp:Button ID="Button2" runat="server" Text="下一步" OnClick="Button2_Click" /></td>
77 </tr>
78 </table>
79 </asp:Panel>
80 <asp:Panel ID="Panel3" runat="server" BorderColor="#0000C0" BorderStyle="Dotted"
81 BorderWidth="1px" Height="221px" Visible="False" Width="631px">
82 <table border="1" cellpadding="3" style="width: 465pt">
83 <tr>
84 <td colspan="3" style="height: 48px; color: #ff0000; background-color: #ccccff;">
85 用户基本信息<br />
86 <asp:ValidationSummary ID="ValidationSummary2" runat="server" ShowMessageBox="True" />
87 </td>
88 </tr>
89 <tr>
90 <td style="width: 75px; height: 27px">
91 真实姓名:</td>
92 <td align="left" style="width: 45px; height: 27px">
93 <asp:TextBox ID="txtRealName" runat="server" Width="145px">aaaa</asp:TextBox>
94 <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtRealName"
95 ErrorMessage="真实姓名不能为空">*</asp:RequiredFieldValidator></td>
96 <td rowspan="5" style="width: 100px; text-align: center;">
97 <asp:Image ID="Image1" runat="server" Height="157px" Width="126px" /></td>
98 </tr>
99 <tr>
100 <td style="width: 75px; height: 25px">
101 性别:</td>
102 <td align="left" style="width: 45px; height: 25px">
103 <asp:RadioButtonList ID="rBtnlSex" runat="server" RepeatDirection="Horizontal" TextAlign="Left">
104 <asp:ListItem Selected="True">男</asp:ListItem>
105 <asp:ListItem>女</asp:ListItem>
106 </asp:RadioButtonList>
107 </td>
108 </tr>
109 <tr>
110 <td style="width: 75px; height: 38px">
111 出生日期:</td>
112 <td align="left" style="width: 45px; height: 38px">
113 <asp:TextBox ID="txtBirth" runat="server" Width="143px">1980-1-1</asp:TextBox>
114 <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtBirth"
115 Display="Dynamic" ErrorMessage="出生日期不能为空">*</asp:RequiredFieldValidator>
116 <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtBirth"
117 ErrorMessage="日期超出范围" MaximumValue="2000-01-01" MinimumValue="1950-01-01">*</asp:RangeValidator></td>
118 </tr>
119 <tr>
120 <td style="width: 75px; height: 36px">
121 省份:</td>
122 <td align="left" style="width: 45px; height: 36px">
123 <asp:DropDownList ID="selSheng" runat="server" Width="146px">
124 </asp:DropDownList></td>
125 </tr>
126 <tr>
127 <td style="width: 75px; height: 41px">
128 城市:</td>
129 <td align="left"<
2
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" >
6<head runat="server">
7 <title>无标题页</title>
8</head>
9<body>
10 <form id="form1" runat="server">
11 <div style="text-align: center">
12 <asp:Panel ID="Panel1" runat="server" BorderColor="#0000C0" BorderStyle="Dotted"
13 BorderWidth="1px" Height="221px" Width="631px">
14 <table style="height: 100%">
15 <tr>
16 <td style="font-weight: bold; font-size: 18pt; width: 635px; color: gold; height: 41px;
17 background-color: #9999ff">
18 用户注册</td>
19 </tr>
20 <tr>
21 <td align="left" style="width: 600px; height: 38px">
22 注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,注册协议,</td>
23 </tr>
24 <tr>
25 <td style="width: 635px; height: 50px">
26 <asp:RadioButton ID="rBtnAgree" runat="server" GroupName="agree" Text="同意" />
27 <asp:RadioButton ID="rBtnNotAgree" runat="server" Checked="True" GroupName="agree"
28 Text="不同意" /></td>
29 </tr>
30 <tr>
31 <td style="width: 635px; height: 37px; background-color: silver">
32 <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="下一步" /></td>
33 </tr>
34 </table>
35 </asp:Panel>
36 <asp:Panel ID="Panel2" runat="server" BorderColor="#0000C0" BorderStyle="Dotted"
37 BorderWidth="1px" Height="221px" Visible="False" Width="631px">
38 <table border="1" cellpadding="0" cellspacing="0" style="width: 622px">
39 <tr>
40 <td colspan="3" style="font-weight: bold; font-size: 18px; color: #ffff00; height: 46px;
41 background-color: #6699ff">
42 用户登录</td>
43 </tr>
44 <tr>
45 <td style="width: 174px; height: 35px; text-align: right">
46 用户名:</td>
47 <td colspan="2" style="height: 35px; text-align: left">
48 <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox><asp:RequiredFieldValidator
49 ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtUserName" Display="Dynamic"
50 ErrorMessage="用户名不能为空">*</asp:RequiredFieldValidator>
51 <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="txtUserName"
52 Display="Dynamic" ErrorMessage="用户名已经存在" OnServerValidate="CustomValidator1_ServerValidate">*</asp:CustomValidator></td>
53 </tr>
54 <tr>
55 <td style="width: 174px; height: 29px; text-align: right">
56 密码:</td>
57 <td colspan="2" style="height: 29px; text-align: left">
58 <asp:TextBox ID="txtUserPwd" runat="server"></asp:TextBox><asp:RequiredFieldValidator
59 ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtUserPwd" Display="Dynamic"
60 ErrorMessage="密码不能为空">*</asp:RequiredFieldValidator></td>
61 </tr>
62 <tr>
63 <td style="width: 174px; height: 29px; text-align: right">
64 确认密码:</td>
65 <td colspan="2" style="height: 29px; text-align: left">
66 <asp:TextBox ID="txtUserPwdAgain" runat="server"></asp:TextBox>
67 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtUserPwdAgain"
68 Display="Dynamic" ErrorMessage="确认密码不能为空">*</asp:RequiredFieldValidator>
69 <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtUserPwd"
70 ControlToValidate="txtUserPwdAgain" ErrorMessage="两次密码输入不相同">*</asp:CompareValidator></td>
71 </tr>
72 <tr>
73 <td colspan="3" style="height: 60px">
74 <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" />
75 <br />
76 <asp:Button ID="Button2" runat="server" Text="下一步" OnClick="Button2_Click" /></td>
77 </tr>
78 </table>
79 </asp:Panel>
80 <asp:Panel ID="Panel3" runat="server" BorderColor="#0000C0" BorderStyle="Dotted"
81 BorderWidth="1px" Height="221px" Visible="False" Width="631px">
82 <table border="1" cellpadding="3" style="width: 465pt">
83 <tr>
84 <td colspan="3" style="height: 48px; color: #ff0000; background-color: #ccccff;">
85 用户基本信息<br />
86 <asp:ValidationSummary ID="ValidationSummary2" runat="server" ShowMessageBox="True" />
87 </td>
88 </tr>
89 <tr>
90 <td style="width: 75px; height: 27px">
91 真实姓名:</td>
92 <td align="left" style="width: 45px; height: 27px">
93 <asp:TextBox ID="txtRealName" runat="server" Width="145px">aaaa</asp:TextBox>
94 <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtRealName"
95 ErrorMessage="真实姓名不能为空">*</asp:RequiredFieldValidator></td>
96 <td rowspan="5" style="width: 100px; text-align: center;">
97 <asp:Image ID="Image1" runat="server" Height="157px" Width="126px" /></td>
98 </tr>
99 <tr>
100 <td style="width: 75px; height: 25px">
101 性别:</td>
102 <td align="left" style="width: 45px; height: 25px">
103 <asp:RadioButtonList ID="rBtnlSex" runat="server" RepeatDirection="Horizontal" TextAlign="Left">
104 <asp:ListItem Selected="True">男</asp:ListItem>
105 <asp:ListItem>女</asp:ListItem>
106 </asp:RadioButtonList>
107 </td>
108 </tr>
109 <tr>
110 <td style="width: 75px; height: 38px">
111 出生日期:</td>
112 <td align="left" style="width: 45px; height: 38px">
113 <asp:TextBox ID="txtBirth" runat="server" Width="143px">1980-1-1</asp:TextBox>
114 <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtBirth"
115 Display="Dynamic" ErrorMessage="出生日期不能为空">*</asp:RequiredFieldValidator>
116 <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtBirth"
117 ErrorMessage="日期超出范围" MaximumValue="2000-01-01" MinimumValue="1950-01-01">*</asp:RangeValidator></td>
118 </tr>
119 <tr>
120 <td style="width: 75px; height: 36px">
121 省份:</td>
122 <td align="left" style="width: 45px; height: 36px">
123 <asp:DropDownList ID="selSheng" runat="server" Width="146px">
124 </asp:DropDownList></td>
125 </tr>
126 <tr>
127 <td style="width: 75px; height: 41px">
128 城市:</td>
129 <td align="left"<