protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Dlt") { DataTable dt = new DataTable(); GridViewRow gvrow = (GridViewRow)((Control)e.CommandSource).NamingContainer; Label lblSupCode = (Label)gvrow.FindControl("lblSupCode"); dt = objDist.DeleteSuplyBAL(lblSupCode.Text, "D", ConnKey); if (dt.Rows.Count > 0) { objCommon.ShowAlertMessage(dt.Rows[0][0].ToString()); txtSname.Text = ""; txtSaddress.Text = ""; txtemail.Text = ""; txtMbno.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"); } }