private void FillCombo() { List <VolarisState> listState = VolarisStateBL.GetAllState(); foreach (VolarisState stateItem in listState) { ListItem litem2 = new ListItem(); litem2.Text = string.Format("{0} - {1}", stateItem.StateID.ToString(), stateItem.Name.ToString().TrimEnd()); litem2.Value = stateItem.StateID.ToString(); contactStateComboBox.Items.Add(litem2); } List <VolarisCountry> listCountries = VolarisCountriesBL.GetAllContries(); foreach (VolarisCountry countryItem in listCountries) { ListItem litem = new ListItem(); litem.Text = string.Format("{0} - {1}", countryItem.Id, countryItem.Name.TrimEnd()); litem.Value = countryItem.Id; contactCountryComboBox.Items.Add(litem); } }
/// <summary> /// Loads the data source nationality. /// </summary> private void LoadDataSourceNationality() { List <VolarisCountry> listCountries = VolarisCountriesBL.GetAllContries(); //bindingSource1.DataSource = listCountries; foreach (VolarisCountry countryItem in listCountries) { ListItem litem = new ListItem(); litem.Text = string.Format("{0} - {1}", countryItem.Id, countryItem.Name.TrimEnd()); litem.Value = countryItem.Id; this.NationalityComboBox.Items.Add(litem); } this.NationalityComboBox.DisplayMember = "Text"; this.NationalityComboBox.ValueMember = "Value"; this.NationalityComboBox.SelectedIndex = 141; }