Back to Devexpress

GridLookUpEdit.GetSelectedDataRow() Method

windowsforms-devexpress-dot-xtraeditors-dot-gridlookupedit-977306a8.md

latest3.5 KB
Original Source

GridLookUpEdit.GetSelectedDataRow() Method

Returns a data source row corresponding to the currently selected edit value.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
public override object GetSelectedDataRow()
vb
Public Overrides Function GetSelectedDataRow As Object

Returns

TypeDescription
Object

An object that represents a data source row corresponding to the currently selected edit value.

|

Remarks

The currently selected value is specified by the editor’s EditValue property. The GetSelectedDataRow method returns the data source row that contains this edit value in the key field, specified by the RepositoryItemLookUpEditBase.ValueMember property.

To get access to other data source rows by their key field values, use the RepositoryItemGridLookUpEditBase.GetRowByKeyValue method.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetSelectedDataRow() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-winforms-label-report-in-code/CS/Reporting_how-to-create-a-label-report-at-runtime-t473792/Form1.cs#L101

csharp
var gridLookUpEdt = (sender as GridLookUpEdit);
var selectedRow = gridLookUpEdt.GetSelectedDataRow();
if (selectedRow == null)

reporting-winforms-label-report-in-code/VB/Reporting_how-to-create-a-label-report-at-runtime-t473792/Form1.vb#L94

vb
Dim gridLookUpEdt = (TryCast(sender, GridLookUpEdit))
Dim selectedRow = gridLookUpEdt.GetSelectedDataRow()
If selectedRow Is Nothing Then

See Also

EditValue

GetRowByKeyValue(Object)

GridLookUpEdit Class

GridLookUpEdit Members

DevExpress.XtraEditors Namespace