protected void grdMain_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { Count = 0; } if (e.Row.RowType == DataControlRowType.DataRow) { OpenTyreDAL obj = new OpenTyreDAL(); int ICount = obj.ICount(Convert.ToString(DataBinder.Eval(e.Row.DataItem, "SerialNo"))); double amnt = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "OpenRate")); dblNetAmnt = amnt + dblNetAmnt; if (ICount > 0) { LinkButton lblDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete"); LinkButton lbledit = (LinkButton)e.Row.FindControl("lnkbtnEdit"); lblDelete.Enabled = false; lblDelete.ToolTip = "Issued"; lbledit.Enabled = false; lbledit.ToolTip = "Issued"; } Count++; // Used to hide Delete button if ItemgrpId exists in Rate Master,Goods Received, Quotation,GR Preparation,Commission Master LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete"); LinkButton lnkbtnEdit = (LinkButton)e.Row.FindControl("lnkbtnEdit"); string ItemIdno = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "TyreIdno")); string SerialNo = string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(e.Row.DataItem, "SerialNo"))) ? "0" : Convert.ToString(DataBinder.Eval(e.Row.DataItem, "SerialNo")); if (ItemIdno != "") { BindDropdownDAL obj1 = new BindDropdownDAL(); var ItemExist = obj1.CheckItemExistInOtherMaster(SerialNo); if (ItemExist != null && ItemExist.Count > 0) { lnkbtnDelete.Visible = false; lnkbtnEdit.Visible = false; } else { lnkbtnEdit.Visible = true; lnkbtnDelete.Visible = true; } } // end---- } if (e.Row.RowType == DataControlRowType.Footer) { Label lblQuantity = (Label)e.Row.FindControl("lblRecordCount"); Label lblAmntTot = (Label)e.Row.FindControl("lbltotAmount"); lblQuantity.Text = Convert.ToDouble(grdMain.Rows.Count).ToString("N2"); //lblAmntTot.Text = dblNetAmnt.ToString("N2"); } }