asp:Button ID="Button1" 怎么弹出确认对话框?
用户名:<asp:TextBox ID="name" runat="server"></asp:TextBox>密 码:<asp:TextBox ID="accountPassword" runat="server"></asp:TextBox>
email:<asp:TextBox ID="email" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="注册" onclick="Button1_Click" />
怎么弹出让用户确认执行注册的对话框?
点否不执行任何操作,点是执行注册操作,转到另一个页面
protected void Button1_Click(object sender, EventArgs e)
{
string name = this.name.Text.Trim().ToString();
string accountPassword = this.accountPassword.Text.Trim().ToString();
string email = this.email.Text.Trim().ToString();
bool flag = new ECardAccountDAO().selectByEmail(email);
if (flag)
{
this.lblMessage.Text = "该email已被使用!";
}
else
{
bool rs = new ECardAccountDAO().Insert(Guid.NewGuid().ToString(), name, email, accountPassword);
if (!rs)
{
Session["name"] = name;
Session["accountPassword"] = accountPassword;
Session["email"] = email;
Response.Redirect("registerSuccess.aspx");
}
}
}