protected void GvMandal_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Dlt") { DataTable dt = new DataTable(); StateCode = Session["StateCd"].ToString(); UserName = Session["UsrName"].ToString(); GridViewRow gvrow = (GridViewRow)((Control)e.CommandSource).NamingContainer; HiddenField hdndistcode = (HiddenField)gvrow.FindControl("hdndistcode"); Label lblMCode = (Label)gvrow.FindControl("lblMCode"); Label lblMName = (Label)gvrow.FindControl("lblMName"); dt = objDist.DeletemandalBAL(hdndistcode.Value, lblMCode.Text, lblMName.Text, ConnKey); if (dt.Rows.Count > 0) { objCommon.ShowAlertMessage(dt.Rows[0][0].ToString()); txtMandalCode.Text = ""; txtMandalName.Text = ""; btn_Save.Visible = true; btn_Update.Visible = false; Viewdata(); } } } catch (Exception ex) { ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString()); Response.Redirect("~/Error.aspx"); } }