将数据导入gridview devexpress

时间:2012-05-20 12:37:51

标签: devexpress gridcontrol

在gridcontrol devexpress中,我将“employee_id”列显示为组合框。我想将来自EMPLOYEES表的数据填入gridcontrol devexpress中的“employee_id”列。感谢。

1 个答案:

答案 0 :(得分:0)

我建议您处理GridView.ShownEditor事件。在此事件处理程序中,您可以获取列编辑器的当前显示的克隆,并筛选其项目。以下是一些示例代码:

private void gridView_ShownEditor(object sender, EventArgs e) {
    GridView view = (GridView)sender;
    if (view.FocusedColumn != employee_id) return;
    ComboBoxEdit editor = (ComboBoxEdit)view.ActiveEditor;       
    // Here bind the editor DataSource and ValueMember and 
       Display member to employee_id
}

其他方式如下: 参考:How to bind dataset with different values to repository combobox in runtime

RepositoryItemComboBox combo = new RepositoryItemComboBox();
            combo.Items.AddRange(new string[{values});
            gridControl1.RepositoryItems.Add(combo);
            gridView1.Columns["Criteria"].ColumnEdit = combo;

价:
 How to populate the RepositoryItemCheckedComboBox with item based on the selection made in another cell
combobox in gridcontrol
Column Value List