Back to Devexpress

RepositoryItemLookUpEdit.GetDisplayValueByKeyValue(Object) Method

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitemlookupedit-dot-getdisplayvaluebykeyvalue-x28-system-dot-object-x29.md

latest4.3 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public virtual object GetDisplayValueByKeyValue(
    object keyValue
)
vb
Public Overridable Function GetDisplayValueByKeyValue(
    keyValue As Object
) As Object

Parameters

NameTypeDescription
keyValueObject

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

|

Returns

TypeDescription
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

GetKeyValueByDisplayValue(Object)

DisplayMember

ValueMember

RepositoryItemLookUpEdit Class

RepositoryItemLookUpEdit Members

DevExpress.XtraEditors.Repository Namespace