Peter Dzuya

Peter Dzuya

  • NA
  • 313
  • 40.7k

Display member and value member SeachLookupEdit Combo

Jun 14 2016 8:55 AM
Hi All,
 
I have a  SeachLookupEdit Combo which I use to fetch data from my Datasource as follows.
 
public partial class frmGatePass : DevExpress.XtraEditors.XtraForm{ 
 
private ISupplierService _supplierService;
private readonly Supplier _supplier;
 
private void frmGatePass_Load(object sender, EventArgs e){
supplierBindingSource.DataSource = _supplierService.GetAll();
}
  
private void contactNameSearchLookUpEdit_EditValueChanged(object sender, EventArgs e) {
try {
var selectedSupplier = contactNameSearchLookUpEditView.GetFocusedRow() as Supplier;
if (selectedSupplier == null)return;
 
_supplier = _supplierService.GetById(selectedSupplier.ContactId);
_supplier.ContactId = selectedSupplier.ContactId;
 
selectedSupplierContactRelationId = selectedSupplier.ContactRelationId;
telephoneTextEditScreen.Text = selectedSupplier.Contact.Telephone;
} catch (Exception Errhandler) {
MessageBox.Show(Errhandler.Message);
}
} 
 
And My Data Binding is as follows:-
DataSource = supplierBindingSource,
Display Member = Contact.ContactName,
Value Member = ContactId.
 
My Problem once I click an item on the drop down list, first it picks the right item, but if I felt I made a wrong choice and click to select another item, I get the Primary Key Id within the List in the first row. How do I sort This kind of an issue.
 
Thanks 
 

Answers (2)