如何从对应的编辑值中获取devexpress的lookupedit显示文本
大家好,
我想在给出相应的编辑值时获得查找编辑显示文本。
例子: 如果我给出
LookupEdit1.Editvalue="3";
,那么它应该显示 Editvalue="3"
的显示文本,
请帮忙
//code
cmbChemical.Properties.DataSource = _lab.selectChemicals();
cmbChemical.Properties.DisplayMember = "labitem_Name";
cmbChemical.Properties.ValueMember = "labItem_ID";
cmbChemical.Properties.BestFitMode = BestFitMode.BestFit;
cmbChemical.Properties.SearchMode = SearchMode.AutoComplete;
cmbChemical.Properties.Columns.Add(new LookUpColumnInfo("labitem_Name", 100, "Chemicals"));
cmbChemical.Properties.AutoSearchColumnIndex = 1;
Hai all,
I want to get lookupedit display text when am giving correspond edit value.
example:
if am giving
LookupEdit1.Editvalue="3";
then it should show display text of Editvalue="3"
please help
//code
cmbChemical.Properties.DataSource = _lab.selectChemicals();
cmbChemical.Properties.DisplayMember = "labitem_Name";
cmbChemical.Properties.ValueMember = "labItem_ID";
cmbChemical.Properties.BestFitMode = BestFitMode.BestFit;
cmbChemical.Properties.SearchMode = SearchMode.AutoComplete;
cmbChemical.Properties.Columns.Add(new LookUpColumnInfo("labitem_Name", 100, "Chemicals"));
cmbChemical.Properties.AutoSearchColumnIndex = 1;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你不能,至少不能以你正在尝试的方式。顾名思义,
LookUpEdit
在DataSource
中查找其值,例如。对象的集合。因此,要显示值3
,您需要有一个包含该值的对象列表,并将其设置为控件的DataSource
。也许如果您指定您想要做什么,我们可以帮助您实现这一目标。
You can't, at least not in the way you're trying. The
LookUpEdit
, as the name implies, looks up its values in aDataSource
, eg. a collection of objects. Therefore, to display the value3
you need to have a list of objects that contains this value and set it as aDataSource
for the control.Maybe if you specify what are you trying to do, we can help you achieve that.
我认为您不必指定显示成员或值成员即可获得所需的行为。以下代码为我提供了一个表单,其中查找编辑正确显示“4”,我也可以从列表中选择其他值。
也许您会得到错误的结果,因为您设置了控件的显示成员和值成员。
I think you don't have to specify display member or value member to get your needed behaviour. Following code give me a form with the lookupedit correctly showing "4", and i can choose other values from the list too.
Maybe you get wrong results because you set display member and value member of the control.
这段代码对我有用。
This code worked for me.