/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { String msg = String.Empty; Button btnSave = sender as Button; EmployeeInfoBLL objEmployeeInfoBLL = new EmployeeInfoBLL(); EmployeeInfo objEmployeeInfo = new EmployeeInfo(); objEmployeeInfo.EmpFullNm = this.txtEmpFullNm.Text; objEmployeeInfo.EmpNickNm = this.txtEmpNickNm.Text; objEmployeeInfo.EmpDesignation = this.txtDesignation.Text; try { if (btnSave.Text == "Edit") { objEmployeeInfo.EmpGid = Convert.ToInt32(this.hf_emp_gid.Value); msg = objEmployeeInfoBLL.EditEmployeeInfo(objEmployeeInfo); this.btnSave.Text = "Save"; } else { msg = objEmployeeInfoBLL.SaveEmployeeInfo(objEmployeeInfo); } Load_gvEmpInfo(); ClearForm(); } catch (Exception exp) { msg = exp.Message; } //Javascript alert message from code behind Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script type=text/javascript>alert('" + msg + "')</script>"); }