protected void BindItems() { double dblTotalPrice = 0.0; clsRequisition requisition = new clsRequisition(txtRequCode.Text); DataTable tblItems = requisition.DSGItems(); dgItems.DataSource = tblItems.DefaultView; //dblTotalPrice = Convert.ToDouble(tblItems.Compute("SUM(tprice)", String.Empty).ToString()); //dgItems.Columns[0].FooterText = " Total ordered items [" + tblItems.Rows.Count + "]"; //dgItems.Columns[4].FooterText = dblTotalPrice.ToString("###,##0.00") + " "; dgItems.DataBind(); DataTable tblCart = ViewState["Cart"] as DataTable; foreach (DataRow drNew in tblItems.Rows) { DataRow drowCart = tblCart.NewRow(); drowCart["itemcode"] = drNew["itemcode"].ToString(); drowCart["itemdesc"] = drNew["itemcode"].ToString(); drowCart["qty"] = drNew["qty"].ToString().ToInt(); drowCart["soqty"] = drNew["soqty"].ToString().ToInt(); drowCart["unit"] = drNew["unit"].ToString(); drowCart["price"] = Double.Parse(drNew["price"].ToString()); drowCart["tprice"] = Double.Parse(drNew["tprice"].ToString()); drowCart["reason"] = drNew["reason"].ToString(); tblCart.Rows.Add(drowCart); } ViewState["Cart"] = tblCart; }
protected void BindItems() { clsRequisition requisition = new clsRequisition(txtRequisitionCode.Text); dgItems.DataSource = requisition.DSGItems(); dgItems.DataBind(); bool blnIssuedAll = false; foreach (DataGridItem ditm in dgItems.Items) { TextBox ptxtBalance = (TextBox)ditm.FindControl("txtBalance"); TextBox ptxtSOQty = (TextBox)ditm.FindControl("txtSOQty"); Label plblSOQtyAll = (Label)ditm.FindControl("lblSOQtyAll"); TextBox ptxtSuppRem = (TextBox)ditm.FindControl("txtSuppRem"); blnIssuedAll = (ptxtBalance.Text == "0" ? true : false); ptxtSOQty.Visible = !blnIssuedAll; plblSOQtyAll.Visible = blnIssuedAll; ptxtSuppRem.ReadOnly = !blnIssuedAll; if (blnIssuedAll) { ptxtSuppRem.BackColor = System.Drawing.Color.FromName("#f0f8ff"); } } }
protected void BindItems() { double dblTotalPrice = 0.0; clsRequisition requisition = new clsRequisition(txtRequCode.Text); DataTable tblItems = requisition.DSGItems(); dgItems.DataSource = tblItems.DefaultView; dblTotalPrice = Convert.ToDouble(tblItems.Compute("SUM(tprice)", String.Empty).ToString()); dgItems.Columns[0].FooterText = " Total ordered items [" + tblItems.Rows.Count + "]"; dgItems.Columns[4].FooterText = dblTotalPrice.ToString("###,##0.00") + " "; dgItems.DataBind(); }