在devexpress gridview中没有设置RipositoryItemCombobox值

本文关键字:设置 RipositoryItemCombobox devexpress gridview | 更新日期: 2023-09-27 18:13:59

我在c#中创建了windows应用程序,在该应用程序中,我在第一列中使用devexpress的gridview控件,我使用repositoryitemcombobox并在repositorycombobox中绑定数据。组合框中有数据,当从下拉框中选择任何数据时,它会显示下拉框中选择的值,但当移动到下一列时,上一列的值显示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;
}

在devexpress gridview中没有设置RipositoryItemCombobox值

您正在使用错误的事件-您应该使用CustomRowCellEdit和/或CustomRowCellEditForEditing事件代替。从他们的文档中阅读以下主题: