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(); }