private void Page_Load(object sender, System.EventArgs e)
{
string username,pwd1,password,userandname,sox,email,datetime;
// 在此处放置用户代码以初始化页面
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.CustomValidator1.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.CustomValidator1_ServerValidate);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Button3.Click += new System.EventHandler(this.Button3_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
if(this.RadioButton1.Checked)
{
this.Panel1.Visible=false;
this.Panel2.Visible=true;
}
}
private void Button2_Click(object sender, System.EventArgs e)
{
if(this.IsValid)
{
this.Panel2.Visible=false;
this.Panel3.Visible=true;
}
}
private void CustomValidator1_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
{
string username=args.Value;
if(DB.judge(username))
{
args.IsValid=false;
}
else
{
args.IsValid=true;
}
}
private void Button3_Click(object sender, System.EventArgs e)
{
userneme=username.Text.Trim();
pwd1=pwd1.Text.Trim();
password=password.Text.Trim();
userandname=userandname.Text.Trim();
if(sox.Checked==true)
{
sox="男";
}
else
{
sox="女";
email=email.Text.Trim();
datetime=datetime.Text.Trim();
SqlConnection con=DB.createCon();
con.Open();
SqlCommand cdm=new SqlCommand("insert into login(username,password,password2,name,sox,email,datetime) values ("'+username+'","'+pwd1+'","'+password+'","'+userandname+'","'+sox+'","'+email+'","'+datetime+'")",con); 这个出错了..~