Skip to main content

RepositoryItemLookUpEdit.GetKeyValueByDisplayText(String) Method

Returns the value of the RepositoryItemLookUpEditBase.ValueMember field for the row whose RepositoryItemLookUpEditBase.DisplayMember value matches the specified text.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v22.2.dll

NuGet Package: DevExpress.Win.Navigation


public virtual object GetKeyValueByDisplayText(
    string displayText


Name Type Description
displayText String

A text representation of the RepositoryItemLookUpEditBase.DisplayMember field in the row to locate.


Type Description

The value of the RepositoryItemLookUpEditBase.ValueMember field for the row located,null if no record with the specified value was found (System.DBNull.Value when the data source is a DataView object).


The GetKeyValueByDisplayText method searches for the record whose RepositoryItemLookUpEditBase.DisplayMember field’s text representation matches the specified string. The value of the RepositoryItemLookUpEditBase.ValueMember field is retrieved by this method. This method returns the value of the first record found.

To get the display value by the record’s key value, see the RepositoryItemLookUpEdit.GetDisplayValueByKeyValue function.

The GetKeyValueByDisplayText and RepositoryItemLookUpEdit.GetDisplayValueByKeyValue methods perform a search among rows that are present in the LookUp editor’s dropdown. If a target row has been hidden due to filtering (see RepositoryItemLookUpEdit.SearchMode), these methods will return null.

See Also