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?

-------------Problems Reply------------

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.

Solved it!

If you set it as follows:

LookUpEdit.Text = [String Value from Database]

IF that string value matches exactly, then the editValue (i.e. the ID) is also correctly set to the item you have pulled from the Database.

This property 'Text' seems somewhat illogical (in my view)(for example they have GetDatasourceByName etc, surely it would make sense to have SetItemByName or something similar!), but it works in any case.

Category:data binding Views:29 Time:2009-08-04

Related post

  • Devexpress LookupEdit is not displaying the selected row for the last row 2010-07-23

    I am using DevExpress.XtraEditors.LookUpEdit to display the information about the classes available. Currently it has 3 columns. The lookupedit is working perfectly except when I set the editValue to the last row. When the editvalue is set to any row

  • How to clear items in DevExpress LookupEdit 2010-09-01

    Hai, Am using DevExpress LookupEdit in C#.NET application.I want to clear all items in the LookupEdit.Please help code: lkpLabItem.Properties.DataSource = null; lkpLabItem .Properties.DataSource = _lab.selectChemicals (); lkpLabItem.Properties.Displa

  • Can't un-select my DevExpress LookUpEdit 2010-10-28

    I have a DevExpress LookUpEdit that I am using withing Visual Studio 2008 in VB.Net. I have the LookUpEdit bound to my datasource and the value that it is displaying may be null or one of the rows in the datasource. My program displays a treelist and

  • How to remove an item from DevExpress LookupEdit? 2010-08-30

    I'm using the DevExpress LookupEdit control in my C# application. How do I remove the selected item from the LookupEdit? --------------Solutions------------- You need to remove the item from the underlying DataSource.

  • How to get selected value from DevExpress LookupEdit? 2010-08-31

    Hai all, Am using DevExpress LookupEdit in C#.NET project,also set both Display Member and Value member property of LookupEdit.How do I get selected value from DevExpress LookupEdit. Thank you --------------Solutions------------- You should use the l

  • How can i display item on itemList of devexpress LookupEdit 2010-08-31

    Hai all, Am using DevExpress LookupEdit in C#.NET project,also set both Display Member and Value member property of LookupEdit and items are not dispaying on LookupEdit list page ,but i can select items. After selecting one item the selected item dis

  • How to fill a Devexpress.LookUpEdit with set values? 2011-02-22

    I have a Devexpress LookUpEdit that I want to fill with 2-3 values. For example "Value 1" (1) and "Value 2" (2). I want this name to be displayMember of the LookUpEdit and the number in brackets be the valueMember so that if I was given the number 1

  • DevExpress LookUpEdit SelectedText Problem 2010-02-18

    I have some lookupedits binded to some lists where the user can choose values and then save in database. I use EditValueChanged events to handle the values. So far all good! Now i need to grab the values from the database and assign them to the looku

  • DevExpress LookUpEdit Behavior 2010-02-05

    I'm tearing my hair off for this amazing problem. I'm binding 2 LookUpEdit from code: MyBinding.DataSource = typeof(MyObject); MyBinding.DataSource = _dataObject.GetMyList(); firstLookUp.DataBindings.Add("EditValue", MyBinding, "Code"); firstLookUp.P

  • DevExpress XtraGrid problem setting value 2010-07-13

    I wonder if someone can help. I have a LookupEdit within a Devexpress Xtragrid which is populated from a list of filenames, as well as an empty option, and a "new" option. If the user selects the "new" option, it goes off to an upload form (which is

  • How to get the devexpress lookupedit display text from the corresponding edit value 2010-09-18

    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

  • DevExpress XtraGrid Problem 2011-01-28

    I want to show excel data in DevExpress data grid. The problem that I am facing is as follows:- I select one worksheet from excel work book and display it in data grid, this works fine but, When I select another worksheet from same same excel workboo

  • Devexpress Xtratreelist - Problem with focusing node that is invisible 2011-02-19

    I have devexpress xtralist on window form. Now when that tree becomes full that is some nodes are not visible there on tree. And if we scroll manually then that invisible nodes will be visible, but problem is if we press down arrow key one by one and

  • DevExpress LookupEdit - setting the selected DataRow by code 2011-09-22

    I am aware that there other questions like this, but their solutions do not work for me. I have the following code: lueSizes.Properties.DataSource = new BindingSource(PS.PaperSizes, null); lueSizes.Properties.Columns.Add(new LookUpColumnInfo("PaperNa

  • Binding entity framework query to Devexpress LookUpEdit and ComboBoxEdit 2012-01-28

    I've a simple table with only one column UrzadSkarbowyWojewodztwo that I'm trying to attach Entity Framework query to ComboBoxEdit or LookUpEdit (preferably both for reference). Can somebody share a a way to do this considering that I don't want do i

  • How to get Devexpress LookupEdit Value Member Value? 2012-02-15

    Hi Im using devexpress . I want to know how to get the value member value in lookupEdit. I set the DisplayMember as prior to SupplierName And ValueMember to SupplierID The code below displays both and SupplierName as the text in lookupedit.. what I w

  • Devexpress gridview problem 2011-01-23

    when i access on database before binding the gridview the gridview never binding again here some code: void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { date.Date = DateTime.Now; string mode = Request.Params["mode"].ToString().ToLowerIn

  • Difference between LookupEdit and ComboBoxEdit in DevExpress 2011-05-09

    Hi all, I want to know what is the difference between 2 controls in DevExpress. Those are LookupEdit and ComboBoxEdit. Thanks in advance. --------------Solutions------------- The LookupEdit is an editor which obtains items for its DropdownWindow from

  • WPF Devexpress ComboBoxEdit Items 2009-12-01

    i use devexpress comboBoxEdit component in my WPF app. I assign values for it like this: private void Users1_Load() { DataTable dtCat = SqlHelper.GetTable("base_UserCategory_Select", new string[] { }); DataRow dr = dtCat.NewRow(); dr["UserCategoryID"

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.071 (s). 11 q(s)