private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { comboBox2.Items.Clear(); Regimen DummyReg = new Regimen(-1, " - Seleccione el régimen - ", 0, true); comboBox2.Items.Add(DummyReg); comboBox2.SelectedItem = DummyReg; if (comboBox1.SelectedIndex == 0) { return; } List <Regimen> Regimenes = new RegimenDAO().ObtenerRegimenesActivosDeHotel((Hotel)comboBox1.SelectedItem); comboBox2.Items.AddRange(Regimenes.ToArray()); }
private void LoadData() { Regimen DummyReg = new Regimen(-1, " - Seleccione el régimen - ", 0, true); comboBox2.Items.Add(DummyReg); if (Session.Hotel != null) { List <Regimen> Regimenes = new RegimenDAO().ObtenerRegimenesActivosDeHotel(Session.Hotel); comboBox2.Items.AddRange(Regimenes.ToArray()); } comboBox2.SelectedItem = DummyReg; List <Hotel> Hoteles = new HotelDAO().ObtenerHoteles(); Hotel Dummy = new Hotel(-1, " - Seleccione un hotel - "); comboBox1.Items.Add(Dummy); comboBox1.Items.AddRange(Hoteles.ToArray()); comboBox1.SelectedItem = Dummy; }