Originally Posted 28 February 2017, 5:19 am ESTHello everyone. I have a table tbl_Nationality with 2 fields ID and NameEN in Sql Server. I bind it to C1ComboBox using Linq, and I want to display a country(index 5) as default when first load. Here is my code:
SHDataContext db = new SHDataContext();
cboNationality.ItemsDataSource = (from s in db.tbl_Nationalities select s).ToList();
cboNationality.ItemsDisplayMember = "NameEN";
cboNationality.ItemsValueMember = "ID";
cboNationality.InitialSelectedIndex = 5;
I have 2 troubles: it does't show the name of country(index 5) when first load. And when event SelectedItemChanged occur, instead of display NameEN, the c1combobox display ID of that country.(see attach picture). Any suggestions? Thanks you.