protected void Page_Load(object sender, EventArgs e) { #region is Postback............ if (!Page.IsPostBack) { ClaimToDAL obj = new ClaimToDAL(); dtTemp = CreateDt(); ViewState["dt"] = dtTemp; this.BindDateRange(); this.BindPartyName(); this.BindCompany(); if (Convert.ToString(Session["Userclass"]) == "Admin") { this.BindCity(); } else { this.BindCity(Convert.ToInt64(Session["UserIdno"])); } ddlDateRange.SelectedIndex = 0; ddlDateRange_SelectedIndexChanged(null, null); GetMaxClaimNoToCompany(); rdoAgnSend.Checked = true; if (Request.QueryString["ClaimHeadIdno"] != null) { this.Populate(Convert.ToInt64(Request.QueryString["ClaimHeadIdno"].ToString())); var ClaimExist = obj.Exists(Convert.ToInt64(Request.QueryString["ClaimHeadIdno"])); if (ClaimExist != null && ClaimExist.Count > 0) { DivSave.Visible = false; } else { DivSave.Visible = true; } ddlDateRange.Enabled = false; lnkbtnNew.Visible = true; } else { lnkbtnNew.Visible = false; } } #endregion }
protected void grdMain_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete"); Int64 intClaimToComHeadIdno = Convert.ToInt64(DataBinder.Eval(e.Row.DataItem, "ClaimToComHead_Idno")); if (intClaimToComHeadIdno > 0) { ClaimToDAL obj = new ClaimToDAL(); var ClaimExist = obj.Exists(Convert.ToInt64(intClaimToComHeadIdno)); obj = null; if (ClaimExist != null && ClaimExist.Count > 0) { lnkbtnDelete.Visible = false; } else { lnkbtnDelete.Visible = true; } } } }