Skip to main content

RepositoryItemLookUpEdit.GetNotInListValue Event

Occurs on retrieving values for fields not found in the RepositoryItemLookUpEditBase.DataSource.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation


public event GetNotInListValueEventHandler GetNotInListValue

Event Data

The GetNotInListValue event's data class is GetNotInListValueEventArgs. The following properties provide information specific to this event:

Property Description
FieldName Gets the field for which you should provide the value for the specified record.
Value Gets or sets a field value.


Lookup editors are capable of displaying unbound columns in their dropdown window, i.e. columns which are not bound to a field from the RepositoryItemLookUpEditBase.DataSource. Cell values for such columns are retrieved via the GetNotInListValue event. This event is also fired when RepositoryItemLookUpEditBase.DisplayMember or RepositoryItemLookUpEditBase.ValueMember properties refer to fields that are not found in the data source.

In order to distinguish an unbound column from other columns (bound and unbound), you should specify its field name via the LookUpColumnInfo.FieldName property. The field name of an unbound column must not refer to a field in the RepositoryItemLookUpEditBase.DataSource. Otherwise, the GetNotInListValue event will not be fired.

See the RepositoryItemLookUpEdit.Columns property to manipulate lookup editor columns.

The event parameter of the GetNotInListValueEventArgs class provides properties specific to the event. The field, for which you should provide a value, is identified by GetNotInListValueEventArgs.FieldName. The record, for which the value must be returned, is defined by the RecordIndex property. This specifies the zero-based index of the record in the data source.

To return a field value for the specified record, assign it to the GetNotInListValueEventArgs.Value property.

The editor’s LookUpEdit.GetNotInListValue event is equivalent to the current event.


The code below shows how to make a lookup editor display data from a custom array. The editor contains two columns. One column is bound to a field from the data source. The other column is unbound and is populated via the RepositoryItemLookUpEdit.GetNotInListValue event.

The data source of a lookup editor represents an array of Record class objects. The Record class declares the public Country property whose values are displayed in the column of the same name. The lookup editor also contains an ID column. Its field name (“ID”) does not coincide with any fields from the data source. So this column is unbound and is populated via the RepositoryItemLookUpEdit.GetNotInListValue event. In the event handler, we return the record id as a value for the column.

The following image shows the lookup editor after running this code:


using DevExpress.XtraEditors.Controls;

//The class representing a row in a lookup editor
public class Record {
    private string country;
    public Record(string country) { = country;
    public string Country {
        get { return country; }
        set { country = value; }

// ...
// An array of records displayed in the dropdown in the lookup editor
Record[] records = null;

//Fill the records array
private void InitData() {
    string[] data = (new string[] {"United States", "Afghanistan", "Albania", "Algeria",
  "Andorra", "Angola"});
    records = new Record[data.Length];
    for (int i = 0; i < data.Length; i++)
        records[i] = new Record(data[i]);

//Set up the lookup editor
private void InitLookUp() {
    //Specify an array of countries as a data source
    lookUpEdit2.Properties.DataSource = records;
    //The field whose values are displayed in the edit box
    lookUpEdit2.Properties.DisplayMember = "Country";
    //The field whose values match the edit value
    lookUpEdit2.Properties.ValueMember = "Country";

    //Unbound column
    lookUpEdit2.Properties.Columns.Add(new LookUpColumnInfo("ID", "ID", 20));
    //Column bound to the existing 'Country' field from the data source
    lookUpEdit2.Properties.Columns.Add(new LookUpColumnInfo("Country", "Country", 100));

    //Select the first record from the dropdown
    lookUpEdit2.EditValue = records[0].Country;

private void Form1_Load(object sender, System.EventArgs e) {

private void lookUpEdit2_GetNotInListValue(object sender, GetNotInListValueEventArgs e) 
    //provide a value for the ID field
    if (e.FieldName == "ID")
        e.Value = e.RecordIndex.ToString() + ".";
See Also