protected void btnAdd_Click(object sender, EventArgs e) { try { BusinessObjects bo = new BusinessObjects(); if (Page.IsValid) { //check whether user id already exists int retValue = bo.CheckDupUser(txtUserID.Text); if (retValue > 0) { ViewState["UserState"] = "User ID already exists"; Page.Validate(); } else { //Add user string strSex = ""; if (chkMale.Checked == true) { strSex = "M"; } else if (chkFemale.Checked == true) { strSex = "F"; } else if (chkOther.Checked == true) { strSex = "O"; } string strName = txtFirstName.Text + " " + txtLastName.Text; //EncryptDecrypt crypt = new EncryptDecrypt(); string strEncryptedPwd = EncryptDecrypt.Encrypt(txtPwd.Text); bool blRetval = bo.CreateInst(txtUserID.Text, strEncryptedPwd, strName, "Student", "Student", txtPhone.Text, txtEmail.Text, strSex); Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertScript", "AlertBox()", true); //Response.Redirect("Login.aspx"); } } } catch { } }