private void Change_Password() { try { Rep_General passwordSave = new Rep_General(); DataTable user = (DataTable)Session["user"]; string passMsg = ""; int userId = int.Parse(user.Rows[0]["UserID"].ToString()); //TextBox txtBusinessDate = (TextBox)Page.Master.FindControl("txtOldPassword"); string oldPass = txtOldPassword.Text; string newPass = txtNewPassword.Text; if (correctFX1.Value != "1") { if (txtNewPassword.Text != txtConfirmPassword.Text) { chngPasswordMsg.Text = "New password does not match the confirm password"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Pop", string.Format("ClosepassModal();"), true); } else { passMsg = passwordSave.Password_Save(userId, oldPass, newPass); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Pop", string.Format("ClosepassModal();"), true); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", passMsg), true); } } } catch (Exception ex) { string error = ex.Message; string errText = error.Replace("\'", ""); string AlertMSG = ""; AlertMSG += errText; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Pop", string.Format("ClosepassModal();"), true); } }