RepositoryItemLookUpEditBase.ValueMember Property

Gets or sets the field name whose values identify dropdown rows.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v21.1.dll


public virtual string ValueMember { get; set; }

Property Value

Type Default Description


The string representing the field name whose values identify dropdown rows.


ValueMember is a key property that must be assigned when setting up the lookup editor. It represents the field name whose values are used to identify dropdown rows. The field value of the row currently selected matches the editor’s edit value, i.e., when you select a row from the dropdown its ValueMember field value is assigned to the editor’s BaseEdit.EditValue (the display text for the edit box is retrieved from the RepositoryItemLookUpEditBase.DisplayMember field for the row). Similarly, when you change the edit value, the editor locates and retrieves the record whose ValueMember field contains the new value.

If the ValueMember property is set to an empty string, selecting a row from the dropdown assigns the object which represents this row to the editor’s edit value.

The source of dropdown rows is specified by the RepositoryItemLookUpEditBase.DataSource property.

For LookUpEdit editors, ValueMember can be set to a field name that may or may not exist in the data source. If the field name does not exist, it is assumed that you will handle the RepositoryItemLookUpEdit.GetNotInListValue event and retrieve values for the field yourself. If the field is found in the data source, its value is retrieved automatically.

For GridLookUpEdit editors, ValueMember can only be set to a field that exists in the data source.


The ValueMember property must refer to a column that contains unique values. If the data source does not contain this column, you can add an unbound column to a look up editor and populate this column with unique values by handling the LookUpEdit.GetNotInListValue event. This approach is only applicable for LookUpEdit controls.


If the lookup editor’s edit value is bound to a field in a data source, this field’s type must match the type of the ValueMember field.


The case of the strings assigned to the ValueMember and DisplayMember properties must exactly match the case of the names of the columns in the underlying data source.

Refer to the LookUpEdit topic for more information on setting up the lookup editor.

Dictionary as a Data Source

If you use a Dictionary<TKey,TValue> as a data source for a lookup editor, the editor uses keys and values as follows:

  • the TKey values — as actual values. These values are assigned to the editor when a user selects an item in the drop-down box.
  • the TValue values — as string representations of the actual values. These strings are displayed in the edit box and drop-down window.

There is no need to specify the ValueMember and DisplayMember properties.


The TKey and TValue parameters should be of the String type or a value type. For example, keys are integers and values are strings.

See the following topic for more information: Dictionary as a Data Source for a Lookup Editor.


This example shows how to use an in-place LookUpEdit control (RepositoryItemLookUpEdit) for editing cells in a grid column.The lookup editor in the example is used to edit the CategoryID field values from the Products list. However, instead of displaying category IDs, the editor will display corresponding category names in the edit box.The main properties used to set up the LookUpEdit control are:- DataSource - Specifies the lookup data source.- ValueMember - Specifies the field from the lookup data source whose values match the editor’s edit value.- DisplayMember - Identifies the field from the lookup data source whose values match the editor’s display text.

The following image shows the result.


View Example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LookupEdit_StandardBinding {
    static class Program {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main() {
            Application.Run(new Form1());
See Also