Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 未在devexpress gridview中设置RipositoryItemCombobox值_C#_Gridview_Devexpress - Fatal编程技术网

C# 未在devexpress gridview中设置RipositoryItemCombobox值

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

我是用c语言创建的windows应用程序,在该应用程序中,我在第一列中使用了devexpress的gridview控件,我使用了repositoryitemcombobox,并在repositorycombobox中绑定了数据。combobox有数据,当从下拉列表中选择任何数据时,它将显示从下拉列表中选择的值,但当移动到下一列时,上一列值将显示null

例如:

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事件不起作用。