/// <summary> /// calls inser method to save details to database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string AlertMessage = string.Empty; string message = string.Empty; try { if (ViewState["SchooldropreasonID"].ToString() == "0") { message = Insert(); AlertMessage = "alert('" + message + "');"; if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; cleardetails(); } // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('School Drop reason details added successfully');", true); } else { string uID = Session["USER_ID"].ToString(); int reasonid = Convert.ToInt32(ViewState["SchooldropreasonID"]); SchoolDropReasonBOobj = new SchoolDropReasonBO(); SchoolDropReasonBOobj.Description = txtDescription.Text.ToString(); SchoolDropReasonBOobj.Schooldropreason = txtReasonDropped.Text.ToString(); SchoolDropReasonBOobj.Createdby = Convert.ToInt32(uID);; SchoolDropBLL SchoolDropBLLObj = new SchoolDropBLL(); message = SchoolDropBLLObj.Update(SchoolDropReasonBOobj, reasonid); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; cleardetails(); SetUpdateMode(false); } //BindGrid(true, true); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('School Drop reason details updated successfully');", true); //cleardetails(); } BindGrid(); //btnSave.Text = "Save"; } catch (Exception ex) { string errorMsg = ex.Message.ToString(); Response.Write(errorMsg); } AlertMessage = "alert('" + message + "');"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true); }