DataGrid row selection event

Hi,
I use RowClick event listener on RadzenDataGrid but when I want to know which row was selected it returns null in the bindied value or in the argumentum of event listener.

SelectionMode="DataGridSelectionMode.Single" @bind-Value=@SelectedRows RowClick="@((args) => OnRowClick(args))"

protected void OnRowClick(MouseEventArgs args)

Is there any way to gain the selected object or its id in a DataGrid component, please?

I'm sorry I've noticed just now there is a RowSelect event.

The event arguments of the RowClick event are different.

protected void OnRowClick(DataGridRowMouseEventArgs<MyItem> args)
{
   MyItem item = args.Data;
}
1 Like

In case anyone are still struggeling to trigger an event when a row is selected

Make sure both RowSelect and TItem is set.

TItem="Inovice"
RowSelect="@OnRowSelect"

private void OnRowSelect(Invoice item){
}```