views:

554

answers:

2

Hello, does anyone can say, how to simply put values from DataTable to DevExpress comboBoxEdit Items. In WinForms it was simply like that:

   dtCat = SqlHelper.GetTable("base_UserCategory_Select", new string[] {});
    DataRow dr = dtCat.NewRow();
    dr["UserCategoryID"] = 0;
    dr["CategoryName"] = "< All >";
    dr["IsSystem"] = "False";
    dtCat.Rows.InsertAt(dr, 0);
    comboBox1.DataSource = dtCat;

How to assign values to DevExpress comboBoxEdit like this?

+1  A: 
DataTable dtCat = SqlHelper.GetTable("base_UserCategory_Select", new string[] { });
DataRow dr = dtCat.NewRow();
dr["UserCategoryID"] = 0;
dr["CategoryName"] = "< All >";
dtCat.Rows.InsertAt(dr, 0);

comboBoxEdit1.ItemsSource = dtCat.DefaultView;

comboBoxEdit1.SelectedIndex = 1;
Vytas999
A: 

I would recommend using a LookupEdit control instead, in conjunction with the DataSource, DisplayMember and ValueMember properties. The ComboBoxEdit control does not have an ItemsSource property.

Brendon