绑定LookupEdit存储库

时间:2012-08-08 04:25:05

标签: data-binding devexpress xtragrid repositorylookupedit

我在devexpress xtragrid控件中有三个lookupedit存储库(三列)。我想基于从lookupedit1和lookupedit3中选择的值基于lookupedit2来绑定lookupedit2。当我点击lookupedit时,我只能看到填充的元素。但是,它不会在网格上显示所选元素。

以下是我使用的代码:

void repositoryLookupEdit1_EditValueChanged(object sender, EventArgs e) {
    LookUpEdit edit = gridView.ActiveEditor as LookUpEdit;
    int val = Convert.ToInt32(edit.EditValue);
    if (!val.Equals(0)) {
        var elements = from e in dc.Elements select e;
        repositoryLookupEdit1.DisplayMember = "paymentType";
        repositoryLookupEdit1.ValueMember = "paymentTypeID";
        repZone.DataSource = bindData(elements);  
    }
}
public BindingSource bindData(object obj) {
    BindingSource ctBinding = new BindingSource();
    ctBinding.DataSource = obj;
    return ctBinding;
}

可能出现什么问题?

1 个答案:

答案 0 :(得分:0)