RadzenDataGrid default selected row

Hello, I'd like to know if there is any way on how to highlight a row on RadzenDataGrid when the component loads depending on the row id passed to the component.

You can use @bind-Value to two-way bind desired item(s):

This is the code a have and even though an adding an object to the SelectedOnBoardingForms list
which is bound to the RadzenDataGrid, when the component loads the row is not heightlightg.
Do you have any suggestions ?

<RadzenDataGrid Style="width:1100px" class="mx-auto mb-5" Data="onBoardingForms" AllowSorting="true" AllowFiltering="true" AllowPaging="true" PageSize="5" SelectionMode="DataGridSelectionMode.Single" @bind-Value=@SelectedOnBoardingForms
PagerHorizontalAlign="HorizontalAlign.Center" FilterMode="FilterMode.Simple" TItem="OnBoardingFormVM" ColumnWidth="200px" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive">




<RadzenButton Icon="edit" Title="Edit" Class="m-1" Click="() => EditNewHireForm(onBoardingFormVM.FormId)" @onclick:stopPropagation="true" />



@code {

private IList<OnBoardingFormVM>? SelectedOnBoardingForms;

protected override async Task OnInitializedAsync()
{
    OnBoardingFormToEdit = await OnBordingFormRepository.GetNewHireFormById(new { FormId = "f047c158-abb6-42b8-ae9a-4f4c4e02b1aa" });
    SelectedOnBoardingForms = new List<OnBoardingFormVM>() { OnBoardingFormToEdit };
}

}`

@Wellington_Munoz don't know if it helps, but here's what I'm using in my Offboarding app for the grid's render event to select & highlight a row -

rendered is initialized to false on page load.

SloSuenos

1 Like