protected void Btn_search_Click(object sender, EventArgs e) { string category = DropDownList_category.SelectedItem.ToString(); GridView_stock.DataSource = StoreBusinessLogic.GetStockByCategory(category); GridView_stock.DataBind(); }
public void showItemInfo(List <Item> iList) { iTable = new DataTable("itemTable"); iTable.Columns.Add(new DataColumn("Item Code", typeof(string))); iTable.Columns.Add(new DataColumn("Description", typeof(string))); iTable.Columns.Add(new DataColumn("Unit of Measure", typeof(string))); iTable.Columns.Add(new DataColumn("Stock", typeof(int))); iTable.Columns.Add(new DataColumn("Reorder Level", typeof(int))); iTable.Columns.Add(new DataColumn("Reorder Quantity", typeof(int))); foreach (Item i in iList) { DataRow dr = iTable.NewRow(); dr["Item Code"] = i.itemID; dr["Description"] = i.description; dr["Unit of Measure"] = i.unitOfMeasure; dr["Stock"] = i.qtyOnHand; dr["Reorder Level"] = i.reorderLevel; dr["Reorder Quantity"] = i.reorderQty; iTable.Rows.Add(dr); } GridView_stock.DataSource = iTable; GridView_stock.DataBind(); }