Back to Devexpress

RepositoryItemLookUpEdit.GetDataSourceRowByDisplayValue(Object) Method

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

latest3.5 KB
Original Source

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

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public virtual object GetDataSourceRowByDisplayValue(
    object displayValue
)
vb
Public Overridable Function GetDataSourceRowByDisplayValue(
    displayValue As Object
) As Object

Parameters

NameTypeDescription
displayValueObject

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

|

Returns

TypeDescription
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’:

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

See Also

GetDataSourceRowByKeyValue(Object)

GetDataSourceRowByMultipleKeyValues(Object, Object[], String[])

GetDisplayValueByKeyValue(Object)

GetKeyValueByDisplayValue(Object)

RepositoryItemLookUpEdit Class

RepositoryItemLookUpEdit Members

DevExpress.XtraEditors.Repository Namespace