Skip to main content

DxGrid.GetRowValue(Int32, String) Method

Gets the value of the data source field in the specified row.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public object GetRowValue(
    int visibleIndex,
    string fieldName
)

Parameters

Name Type Description
visibleIndex Int32

The row’s visible index.

fieldName String

The name of the data source field.

Returns

Type Description
Object

The data object contained within the specified data source field.

Remarks

Note

The Grid bound to an Instant Feedback Data Source or GridDevExtremeDataSource loads data asynchronously in small portions (instead of the entire dataset). Before you call the GetRowValue method, call the WaitForRemoteSourceRowLoadAsync(Int32) method to ensure that the specified data row is loaded.

In the following example, click the button to get the “City” column’s cell value in the row whose visible index is 1.

@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable

<DxGrid @ref="@MyGrid"
        PageIndexChanged="Grid_PageIndexChanged"
        Data="@GridDataSource">
    <Columns>
        <DxGridDataColumn FieldName="Country" />
        <DxGridDataColumn FieldName="City" />
        <DxGridDataColumn FieldName="OrderDate" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" />
        <DxGridDataColumn FieldName="Quantity" />
    </Columns>
</DxGrid>
@* ... *@
<DxButton Click="@OnClick">Get City Name in Row 1</DxButton>
<p></p>
City Name: @RowValue

@code {
    IGrid MyGrid { get; set; }
    object RowValue;
    @* ... *@
    object GridDataSource { get; set; }
    NorthwindContext Northwind { get; set; }

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        GridDataSource = Northwind.Invoices
            .ToList();
    }

    void OnClick() {
        RowValue = MyGrid.GetRowValue(1, "City");
    }
    @* ... *@
    public void Dispose() {
        Northwind?.Dispose();
    }
}

DevExpress Blazor Grid - Get Row Value

See Also