This should be a fairly easy task, however I'm a bit stumped, I have a LookUpEdit control, I have databound it to a datasource and set the displaymember and ValueMenber correctly.
This control is now correctly populating.
My problem is that normally I would pull some data and then 'set' it to the ID eg:
LookUpEdit.EditValue = [Some ID from my database]
However In this particular case, I do not have access to the ID BUT I do have access to the displymember value (from the database), so how do I set the LookUpEdit control given the displaymember value only?
Use:
lookUp.EditValue = lookUp.Properties.GetKeyValueByDisplayText(yourDisplayText);
It is preferred way. Using Text property is a bit illogical as you noted. It works now, but I wouldn't be surprised if it stops working in the future after you upgrade DevExpress assemblies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With