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.v20.1.dll

Declaration

public virtual object GetKeyValueByDisplayText(
    string displayText
)
Public Overridable Function GetKeyValueByDisplayText(
    displayText As String
) As Object

Parameters

Name Type Description
displayText String

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

Returns

Type Description
Object

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).

Remarks

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