protected void Apply_Click(object sender, EventArgs e) { clsStockCollection Stock = new clsStockCollection(); Stock.ReportByProductType(txtProduct_Type.Text); LstStockList.DataSource = Stock.StockList; LstStockList.DataValueField = "Product_ID"; LstStockList.DataValueField = "Product_Type"; LstStockList.DataBind(); }
protected void LstStockList_SelectedIndexChanged(object sender, EventArgs e) { //create an instance of the collection ClassLibrary2.clsStockCollection Stocks = new ClassLibrary2.clsStockCollection(); // LstStockList.DataSource = Stocks.StockList; //set the name of the primary key LstStockList.DataValueField = "Product_ID"; //set the data field to display LstStockList.DataValueField = "Product_Type"; //bind the data to the list LstStockList.DataBind(); }
void DisplayStocks() { //create an instance of the collection ClassLibrary2.clsStockCollection Stocks = new ClassLibrary2.clsStockCollection(); //set data source to the list of countries in the collection LstStockList.DataSource = Stocks.StockList; //set the name of the primary key LstStockList.DataValueField = "Product_ID"; //set the data field to display LstStockList.DataValueField = "Product_Type"; //bind the data to the list LstStockList.DataBind(); }