Get Value from Radzen Blazor WASM DataGrid Row with Button

I wasn't able to find the solution anywhere. Any help is much appreciated!

I built a Radzen DataGrid in Blazor. One of the columns is a button. On the clicked event of the button on each row, I want to pick up the values (NMLS, FName, LName) of that particular row and pass it to a function. The DataGrid in-line editing example you have on your website does not pick up a value and pass to a function. It does send an instance of an object, which I tried, but the object was blank. I need to get to the data object of that row. Thanks!

Markup Code








<RadzenButton Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" Click=@(args => ShowDetails(banker.NMLS)) @onclick:stopPropagation="true" >




C# Code
@code{
void ShowDetails(BankerYearly banker)
{
navman.NavigateTo("YTDCompanyShowDetails" + "/" + banker.NMLS);
}
}

@code {
Radzen.DataGridGridLines GridLines = Radzen.DataGridGridLines.Both;

private BankerYearly[] bankerY;

protected override async Task OnInitializedAsync() => bankerY = await Http.GetFromJsonAsync<BankerYearly[]>("sample-data/loytd.json");    

}

Hey @aalvarez,

I’ve just replied to your email with link to Microsoft documentation about Blazor templates. Please check it! Most of the templates in Blazor have @context property which is the data item itself.

So you are saying that the Radzen Datagrid Component does not support getting any values from the rows in the grid and passing to other items (functions, other components, etc.)? Please confirm. Thanks.

You can check this demo which shows how to use the current item in templates: Blazor DataGrid custom appearance via column templates

Looks like you didn’t care to read the article I’ve sent nor to try what I’ve suggested. All you need to do is to use @context.YourPropertyName. It’s that simple.