Ejemplo n.º 1
0
        protected void grdMain_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            // Used to hide Delete and Edit button if Pbillidno exists in Trip Entry
            LinkButton lnkbtnEdit   = (LinkButton)e.Row.FindControl("lnkbtnEdit");
            LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete");
            string     PBillIdno    = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "PBillHead_Idno"));

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                dNetAmnt = dNetAmnt + Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "Net_Amnt"));
            }
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                Label lblAmount = (Label)e.Row.FindControl("lblAmount");
                lblAmount.Text = dNetAmnt.ToString("N2");
            }
            string PurBillid = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "PBillHead_Idno"));

            if (PurBillid != "")
            {
                PurchaseBillDAL obj     = new PurchaseBillDAL();
                var             IdExist = obj.CheckPbill(Convert.ToInt32(PurBillid));
                if (IdExist != null && IdExist.SerlDetl_id > 0)
                {
                    lnkbtnDelete.Visible = false;
                }
                else
                {
                    lnkbtnDelete.Visible = true;
                }
            }
        }