예제 #1
0
    protected void GvDistricts_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "Dlt")
            {
                DataTable dt = new DataTable();
                StateCode = Session["StateCd"].ToString();
                UserName  = Session["UsrName"].ToString();
                Flag_IUP  = "D";
                GridViewRow gvrow       = (GridViewRow)((Control)e.CommandSource).NamingContainer;
                Label       lbldistcode = (Label)gvrow.FindControl("lbldcode");
                Label       lbldistname = (Label)gvrow.FindControl("lbldnm");
                dt = objDist.DeletedistrictBAL(StateCode, lbldistcode.Text, lbldistname.Text, Flag_IUP, ConnKey);
                if (dt.Rows.Count > 0)
                {
                    objCommon.ShowAlertMessage(dt.Rows[0][0].ToString());
                    txtDistCode.Text = "";
                    txt_Date.Text    = "";

                    txtDistCode.Enabled = true;
                    txtDistName.Text    = "";
                    btn_Save.Visible    = true;
                    btn_Update.Visible  = false;
                    getDistrictDtls();
                }
            }
        }
        catch (Exception ex)
        {
            ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString());
            Response.Redirect("~/Error.aspx");
        }
    }