// to show recommended order quantity protected void gvPOItems_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int stationeryID = (int)DataBinder.Eval(e.Row.DataItem, "StationeryID"); if (stationeryID != 0) { TextBox tb = e.Row.FindControl("txtRecommend") as TextBox; DropDownList SupplierDrowDownList = e.Row.FindControl("ddlSupplier") as DropDownList; List<Supplier> suppliers = new List<Supplier>(); using (CatalogManager cm = new CatalogManager()) { List<StationeryPrice> prices = cm.GetStationeryPricesByStationeryID(stationeryID); Stationery stationery = cm.FindStationeryByID(stationeryID); foreach (StationeryPrice p in prices) { suppliers.Add(p.Supplier); } SupplierDrowDownList.DataSource = suppliers; SupplierDrowDownList.DataBind(); if (tb != null) { using (PurchaseOrderManager pom = new PurchaseOrderManager()) { tb.Text = (pom.GetQuantityToOrder(stationeryID) - stationery.QuantityInHand + stationery.ReorderLevel + stationery.ReorderQuantity).ToString(); } } } } } }