开发者

Put values from DataTable in DevExpress comboBoxEdit Items

开发者 https://www.devze.com 2022-12-12 10:24 出处:网络
Can anyone explain开发者_如何学Python, how to simply put values from a DataTable in DevExpress comboBoxEdit Items? In WinForms it was simply like this:

Can anyone explain开发者_如何学Python, how to simply put values from a DataTable in DevExpress comboBoxEdit Items? In WinForms it was simply like this:

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 a DevExpress comboBoxEdit like this?


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;


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消