Skip to main content

RepositoryItemGridLookUpEditBase.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.XtraGrid.v24.1.dll

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

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 row’s RepositoryItemLookUpEditBase.ValueMember field. The value of the RepositoryItemLookUpEditBase.DisplayMember field of the selected row is displayed in the edit box.

See Also