Skip to main content

RepositoryItemLookUpEdit.GetDataSourceRowByDisplayValue(Object) Method

Searches the DisplayMember data field for the specified value and returns the first matching data source record.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public virtual object GetDataSourceRowByDisplayValue(
    object displayValue
)

Parameters

Name Type Description
displayValue Object

The value to search for in the data field specified by the DisplayMember property.

Returns

Type Description
Object

The data source record that contains the specified value. null (Nothing in Visual Basic) if no record with the specified value was found.

Remarks

The lookup editor displays values from the data source field specified by the DisplayMember property. The GetDataSourceRowByDisplayValue method searches this data field for the specified value and returns the first matching record.

Note

The search is case-sensitive.

The GetDataSourceRowByDisplayValue method’s return type varies based on the data source:

  • If the data source is a System.Data.DataTable or System.Data.DataView, the method returns a System.Data.DataRowView object.
  • If the data source is a custom list, the method returns the corresponding list item.

The following code snippet searches the lookup editor’s data source for a record where the ProductName field contains ‘Chai’:

object result = lookUpEdit1.Properties.GetDataSourceRowByDisplayValue("Chai");
See Also