Please pretty please how do I reload the DataGrid

I have used the last 5 hours trying to get this to work.
read all the example also the master-detail grid and the documentation also googled and search this forum.

I can only get the grid to show something when I set the data in OnInitializedAsync().

My scenario is very simple. I fetch some data when you click a row in a grid.
Then I go out and fetch some data I want to display in the grid below.

<RadzenButton Icon="add_circle_outline" style="margin-bottom: 10px" Text="Add Report to Contact" Click="@AddReport">
</RadzenButton>
<RadzenGrid @ref="reportsGrid"
             Data="@ContactReports"
             TItem="ContactReportDto"
             RowSelect="args => SelectedReport = (ContactReportDto)args">
    <Columns>
        <RadzenGridColumn TItem="ContactReportDto" Property="ReportName" Title="Report" />
        <RadzenGridColumn TItem="ContactReportDto" Property="ProductName" Title="Product" />
        <RadzenGridColumn TItem="ContactReportDto" Filterable="false" Sortable="false" Width="70px" TextAlign="TextAlign.Center">
            <Template Context="data">
                <RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="create" Size="ButtonSize.Medium" Click="@(_ => DeleteReportButtonClick(data))" @onclick:stopPropagation="true">
                </RadzenButton>
            </Template>
        </RadzenGridColumn>
    </Columns>
</RadzenGrid> 

Load data works just fine. I have tried StateHasChanged() but the grid never reacts on the new data.

     private async Task GetContactReports(int contactId)
     {
         ContactReports = (List<ContactReportDto>) await ContactReportService.GetContactReports(contactId);
     }
1 Like