protected void GvDiag_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Dlt") { DataTable dt = new DataTable(); UserName = Session["UsrName"].ToString(); GridViewRow gvrow = (GridViewRow)((Control)e.CommandSource).NamingContainer; Label lblTestCd = (Label)gvrow.FindControl("lblTestCd"); dt = objDist.DeleteDiagBAL(ddl_Ins_code.SelectedValue, lblTestCd.Text, ConnKey); if (dt.Rows.Count > 0) { objCommon.ShowAlertMessage(dt.Rows[0][0].ToString()); btn_Save.Visible = true; btn_Update.Visible = false; txtTestFee.Text = ""; txtFeeP.Text = ""; } else { objCommon.ShowAlertMessage(dt.Rows[0][0].ToString()); btn_Save.Visible = true; btn_Update.Visible = false; txtTestFee.Text = ""; txtFeeP.Text = ""; } Viewdata(); } if (e.CommandName == "Edt") { GridViewRow gvrow = (GridViewRow)((Control)e.CommandSource).NamingContainer; ddlDiagTest.Enabled = false; ViewState["DiagTestCode"] = ((Label)(gvrow.FindControl("lblTestCd"))).Text; ddlDiagTest.SelectedItem.Text = ((Label)(gvrow.FindControl("lblTestName"))).Text; txtTestFee.Text = ((Label)(gvrow.FindControl("lblTotFee"))).Text; txtFeeP.Text = ((Label)(gvrow.FindControl("lblFeeP"))).Text; btn_Update.Visible = true; btn_Save.Visible = false; } } catch (Exception ex) { ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString()); Response.Redirect("~/Error.aspx"); } }