protected void Button1_Click1(object sender, EventArgs e) { string password = this.generatePassword(); int i; lblErrorNombre.Visible = false; lblErrorCorreo.Visible = false; lblErrorCarnet.Visible = false; btnGuardarNewUser.Enabled = false; //Revisa si los textboxes estan vacidos if (txtName.Text.Equals("") || txtEmail.Text.Equals("") || txtStudentId.Text.Equals("")) { if (txtName.Text.Equals("")) { lblErrorNombre.Visible = true; } if (txtEmail.Text.Equals("")) { lblErrorCorreo.Visible = true; } if (txtStudentId.Text.Equals("")) { lblErrorCarnet.Text = "*Carnet no puede estar vacido"; lblErrorCarnet.Visible = true; } } else { //revisa si carnet o rol son numericos if (!int.TryParse(txtStudentId.Text, out i)) { if (!int.TryParse(txtStudentId.Text, out i)) { lblErrorCarnet.Text = "*Carnet ocupa ser un numero"; lblErrorCarnet.Visible = true; } } else { dataUser.insertUser(txtName.Text, txtEmail.Text, int.Parse(txtStudentId.Text), password, int.Parse(RolList.SelectedValue)); lblNombre.Visible = false; lblEmail.Visible = false; lblStudentId.Visible = false; lblRole.Visible = false; txtName.Visible = false; txtEmail.Visible = false; txtStudentId.Visible = false; RolList.Visible = false; btnCancelar.Visible = false; btnGuardarNewUser.Visible = false; this.sendPassword(password); txtName.Text = ""; txtEmail.Text = ""; txtStudentId.Text = ""; } } Response.Redirect("Admin.aspx"); }