/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { LinkButton btnDelete = sender as LinkButton; //Identify the clicked row int rowIndex = Convert.ToInt32(btnDelete.Attributes["RowIndex"]); GridViewRow gvRow = this.gvEmpInfo.Rows[rowIndex]; //Identify the hidden filed value of clicked row int emp_gid = Convert.ToInt32(((HiddenField)gvRow.FindControl("hidemp_gid")).Value); string msg = String.Empty; try { EmployeeInfoBLL objEmployeeInfoBLL = new EmployeeInfoBLL(); msg = objEmployeeInfoBLL.RemoveEmployeeInfo(emp_gid); 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>"); }