Skip to main content

RepositoryItemSearchLookUpEdit.GetDisplayTextByKeyValue(Object) Method

Returns the text representation of the DisplayMember field value of the row that contains the specified ValueMember field value.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

public virtual string GetDisplayTextByKeyValue(
    object keyValue
)

Parameters

Name Type Description
keyValue Object

The value of the ValueMember field for the row to locate.

Returns

Type Description
String

The text representation of the DisplayMember field value for the row located.

Remarks

The GetDisplayTextByKeyValue method returns the text representation of the value returned by the RepositoryItemSearchLookUpEdit.GetDisplayValueByKeyValue method. If the value requested is null, DBNull.Value or “Non-loaded Value” (see BaseEdit.IsNotLoadedValue), the GetDisplayTextByKeyValue method returns an empty string.

The GetDisplayTextByKeyValue method searches for the record that contains the specified key value (value of the RepositoryItemLookUpEditBase.ValueMember field) and returns the display value it contains. The display value is retrieved from the RepositoryItemLookUpEditBase.DisplayMember field of the record located. This method returns the display value of the first record found.

The row currently selected in a lookup editor is determined by the BaseEdit.EditValue property value, and this matches the value of the row’s ValueMember field. The value of the DisplayMember field of the selected row is displayed in the edit box.

See Also