private void Setuppage() { CarCollection carlst = new CarCollection(); CarDao cardao = new CarDao(); carlst = cardao.Load(); //ComboBox1.DataTextField = "Name"; for (int i = 0; i < 500; i++) { foreach (Car item in carlst) { lstCars.Items.Add(new ListItem(item.Name, item.CarId)); //ComboBox1.Items.Add(new ListItem(item.Name, item.CarId)); } } //ObjectDataSource ods = new ObjectDataSource("CarDao", "Load"); //ComboBox1.DataTextField = "Name"; //ComboBox1.DataValueField = "CarId"; //ComboBox1.DataSource = this.carcollection; this.carcollection = carlst; }
private void Setup() { CarDao cardao = new CarDao(); CarCollection carlst = cardao.Load(); this.grdCars.DataSource = carlst; this.grdCars.DataBind(); }