Get the selected items in a datagrid

Hello team,

I have a little question about the datagrids…

How can I get the selected items in a datagrid? I have been following the example that you have on Blazor DataGrid Component - Multiple Selection | Free UI Components by Radzen and it´s working fine.

But I´m trying launch an event through a button when the user will finish to select some rows. This event would have to do somethings with the selected items on the datagrid, but I don´t know how I can do it…

Could you give me some idea to do it? I have been searching through the community but I couldn´t find something about it.

One more time, thanks a lot for your dedication.

Regards.

Hi @alberto.ramirez,

You can use the RowSelect event, or just add some code in the setter of the property which you have bound the Value of RadzenDataGrid.

<RadzenDataGrid @bind-Value=@Selection ... />

@code {

    IEnumerable<TItem> selection;

    IEnumerable<TItem> Selection
    {
        get => selection;
        set
        {
           selection = value;
           // Your code here
        }
    }

Hi Korchev,

One more time, thanks a lot for your response.