Binding LookupEdit Repository

3.5k Views Asked by At

I've three lookupedit repositories (for three columns) in a devexpress xtragrid control. I want to bind lookupedit2 based on a value selected from lookupedit1 and lookupedit3 based on lookupedit2. I can only see the populated elements when I click on the lookupedit. However, it doesn't display the selected element on the grid.

Here is the code i used:

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;
}

What could be the possible problem?

1

There are 1 best solutions below

1
On