Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8954281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:17:19+00:00 2026-06-15T14:17:19+00:00

I have a DataSource bound to a LookUpEdit . For example I have 2

  • 0

I have a DataSource bound to a LookUpEdit. For example I have 2 columns FirstName and LastName and I want to set DisplayMember property to these two columns.
I found that I should subscribe to lookUp_CustomDisplayText() and edit display text property like this:

private void lookUpCompanyPerson_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
{
     LookUpEdit edit = sender as LookUpEdit;

     if (e.DisplayText != "")
     {
           e.DisplayText = e.DisplayText + " " + (string)e.Value;          
     }            
}

but I did not understand what e.Value is and I want to display another column for selected row, not the valuemember of selected row.

This is how I bind the datasource to lookupedit:

 private void populateComboBoxForCompanyPerson()
 {
     lookUpCompanyPerson.Properties.ForceInitialize();
     bs = new BindingSource(myDataSet, "CompanyPerson");            
     lookUpCompanyPerson.Properties.DataSource = bs;
     lookUpCompanyPerson.Properties.DisplayMember = "CompanyName";
     lookUpCompanyPerson.Properties.ValueMember = "PersonID";
     this.lookUpCompanyPerson.Properties.Columns.Add(new LookUpColumnInfo("PersonID"));
     this.lookUpCompanyPerson.Properties.Columns["PersonID"].Visible = false;            
     this.lookUpCompanyPerson.Properties.Columns.Add(new LookUpColumnInfo("FirstName"));
     this.lookUpCompanyPerson.Properties.Columns.Add(new LookUpColumnInfo("LastName"));
     this.lookUpCompanyPerson.Properties.Columns.Add(new LookUpColumnInfo("CompanyName"));                
 }

And this is what my datasource looks like: datasource

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:17:20+00:00Added an answer on June 15, 2026 at 2:17 pm

    From the DevExpress documentation:

    • e.Value gets or sets editor’s current value.
    • e.DisplayText gets or sets an editor’s display text

    The lookup editor’s value is obtained from the data source field specified by the RepositoryItemLookUpEditBase.ValueMember property. The GetDataSourceRowByKeyValue method searches for the specified value within this field and returns an object representing the first found record.

    The GetDataSourceRowByKeyValue method’s return value depends upon the type of the underlying data source. If the data source is a System.Data.DataTable or a System.Data.DataView, this method returns a System.Data.DataRowView object. If the data source is a custom list of items, the appropriate list item is returned.

    You want to set the e.Value to the value that you want to display in the control.

    private void lookUpCompanyPerson_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
    {
        RepositoryItemLookUpEdit props
        if (sender is LookUpEdit)
            props = (sender as LookUpEdit).Properties;
        else
            props = sender as RepositoryItemLookUpEdit;
        if (props != null && (e.Value is int))
        {
            object row = props.GetDataSourceRowByKeyValue(e.Value);
            if (row != null)
            {
                e.Value = String.Format("{0} {1}", (DataRowView)row["FirstName"], (DataRowView)row["LastName"]);
                e.Handled = true;
            }
        }
    }
    

    Finally, here are some useful pages with more documentation:

    • BaseEdit.CustomDisplayText Event
    • RepositoryItemLookUpEdit.GetDataSourceRowByKeyValue Method
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datasource which contains dated items per row. These will be bound
I have two dropdownlist's.DropDownList2(not bound to a datasource) and DropDownList3(bound to a datasource) On
On a web form we have a DetailsView bound to a dataSource. The property
I have DatagridViewComboBoxColumn bound to a datasource, i want to show First Name +
I have two drop down lists; the first is bound to an entity datasource,
I have a datagridview bound to a datasource, column[0] AgencyName is a primary key
I have a GridView bound to an DataSource query with parameters tied to form
I have a gridview that is bound to a datasource on a Windows Form
I have a gridview that is bound to a datasource (Windows Forms, VB.NET). One
I have an asp:FormView control bound to a datasource. Everything is working fine. If

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.