Skip to main content

DxDataGrid<T>.SingleSelectedDataRow Property

Specifies the selected data row.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

Declaration

[Parameter]
public T SingleSelectedDataRow { get; set; }

Property Value

Type Description
T

A data row.

Remarks

Important

The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.

Use the SingleSelectedDataRow property to specify the selected data row.

Note

Set the SelectionMode property to SingleSelectedDataRow to enable single row selection mode.

Data Grid - Single selected data row

<DxDataGrid Data="@Products" 
            @bind-SingleSelectedDataRow="@SelectedProduct" 
            KeyFieldName="@nameof(Product.ProductId)">
    @* ... *@
</DxDataGrid>

@code {
    IEnumerable<Product> Products { get; set; }
    Product selectedProduct;
    public Product SelectedProduct {
        get {
            return selectedProduct;
        }
        set {
            selectedProduct = value;
            InvokeAsync(StateHasChanged);
        }
    }
    protected override async Task OnInitializedAsync() {
        Products = await NwindDataService.GetProductsAsync();
        Categories = await NwindDataService.GetCategoriesAsync();
        SelectedProduct = Products.FirstOrDefault();
    }
}

Run Demo: Data Grid - Single Row Selection

See Also