Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DevExpress LookUpEdit Problem

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?

like image 877
Darknight Avatar asked Apr 19 '26 08:04

Darknight


1 Answers

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.

like image 75
Przemaas Avatar answered Apr 21 '26 20:04

Przemaas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!