C# 未在devexpress gridview中设置RipositoryItemCombobox值
我是用c语言创建的windows应用程序,在该应用程序中,我在第一列中使用了devexpress的gridview控件,我使用了repositoryitemcombobox,并在repositorycombobox中绑定了数据。combobox有数据,当从下拉列表中选择任何数据时,它将显示从下拉列表中选择的值,但当移动到下一列时,上一列值将显示null 例如:C# 未在devexpress gridview中设置RipositoryItemCombobox值,c#,gridview,devexpress,C#,Gridview,Devexpress,我是用c语言创建的windows应用程序,在该应用程序中,我在第一列中使用了devexpress的gridview控件,我使用了repositoryitemcombobox,并在repositorycombobox中绑定了数据。combobox有数据,当从下拉列表中选择任何数据时,它将显示从下拉列表中选择的值,但当移动到下一列时,上一列值将显示null 例如: private void gridView1_InitNewRow(object sender, InitNewRowEventArgs
private void gridView1_InitNewRow(object sender, InitNewRowEventArgs e) {
FoundryBusinessAccess bal = new FoundryBusinessAccess();
RepositoryItemComboBox comproduct = new RepositoryItemComboBox();
DataTable dtpro = new DataTable();
dtpro = bal.SelectProductName();
List<string> listdata = dtpro.AsEnumerable().Select(r => r.Field<string>("prod_name")).ToList();
foreach (object list in listdata) {
comproduct.Items.Add(list.ToString());
}
gridControl1.RepositoryItems.Add(comproduct);
prod_name.ColumnEdit = comproduct;
}
您使用了错误的事件-应改用CustomRowCellEdit和/或CustomRowCellEditForEditing事件。阅读他们文档中的以下主题。我正在从数据库绑定repositoryitemcombobox,在这种情况下CustomRowCellEdit事件不起作用。