示例#1
0
 protected void Btn_Create_Click(object sender, EventArgs e)
 {
     if (DB.UserAlreadyExist(UserName.Text.Trim().ToString()))
     {
         Lbl_UserNameAlreadyExist.Visible = true;
     }
     else
     {
         DB.AddUser(UserName.Text.Trim().ToString(), Password.Text.Trim().ToString());
         Response.Redirect("UserCreated.aspx");
     }
 }
 protected void Btn_addNewUser_Click(object sender, EventArgs e)
 {
     if (AnyFieldsIsEmpty())
     {
         Lbl_userNameExist.Visible = false;
         Lbl_emptyFields.Visible   = true;
     }
     else if (DB.UserAlreadyExist(UserName.Text.Trim().ToString()))
     {
         Lbl_userNameExist.Visible = true;
         Lbl_emptyFields.Visible   = false;
     }
     else
     {
         DB.AddUser(UserName.Text.Trim().ToString(), Password.Text.Trim().ToString());
         GridView1.DataBind();
         Lbl_userNameExist.Visible = false;
         Lbl_emptyFields.Visible   = false;
         UserName.Text             = "";
         Password.Text             = "";
     }
 }