Skip to main content

RepositoryItemLookUpEdit.GetDisplayValueByKeyValue(Object) Method

Returns a value of the RepositoryItemLookUpEditBase.DisplayMember field of the row containing the specified RepositoryItemLookUpEditBase.ValueMember field value.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v24.2.dll

Declaration

public virtual object GetDisplayValueByKeyValue(
    object keyValue
)

Parameters

Name Type Description
keyValue Object

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

Returns

Type Description
Object

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

Remarks

The GetDisplayValueByKeyValue method searches for the record containing 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 RepositoryItemLookUpEditBase.ValueMember and RepositoryItemLookUpEditBase.DisplayMember properties represent the field names you need to specify, to set up a lookup editor.

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

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

See Also