Versions > 6.1.1 giveDynamic Data Grid gives System.IndexOutOfRangeException: Index was outside the bounds of the array

Hi
I use a dynamic dataset to create a Datagrid and it all works well.
However filtering/sorting or refresh gives the following error. I then updated my version of Radzen Blazor components (I was on 6.018. And version > 6.1.1 now gives that error immediately and I get no rows rendered.

blazor.web.js:1 [2025-03-03T15:07:07.751Z] Error: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Radzen.QueryableExtension.GetNestedPropertyExpression(Expression expression, String property, Type type)
at Radzen.QueryableExtension.OrderBy(IQueryable source, String selector)
at Radzen.QueryableExtension.OrderBy[T](IQueryable1 source, String selector) at Radzen.Blazor.RadzenDataGrid1.get_View()
at Radzen.PagedDataBoundComponent1.get_PagedView() at Radzen.Blazor.RadzenDataGrid1.DrawGroupOrDataRows(RenderTreeBuilder builder, IList1 visibleColumns) at Radzen.Blazor.RadzenDataGrid1.<>c__DisplayClass22_0.b__0(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment)
at Radzen.Blazor.RadzenDataGrid1.<BuildRenderTree>b__679_0(RenderTreeBuilder __builder2) at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment) at Microsoft.AspNetCore.Components.CascadingValue1.Render(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)

Picture Of Working Grid

           <RadzenDataGrid @ref="projectGrid" IsLoading=@isLoading Data="@data" TItem="IDictionary<string, object>" MinWidth="100px"
                           AllowSorting=@FormatSettings.AllowSorting AllowFiltering=@FormatSettings.AllowFiltering AllowPaging=@FormatSettings.AllowPaging
                           PageSize=@FormatSettings.PageSize PagerHorizontalAlign=@FormatSettings.FormPagerAlignment ShowPagingSummary=@FormatSettings.ShowPagingSummary PageSizeOptions=@FormatSettings.PageSizeOptions
                           GotoFirstPageOnSort="true" FilterMode=@FormatSettings.Filtermode GridLines=@FormatSettings.FormGridlines
                           AllowColumnResize=@FormatSettings.AllowColumnResize AllowColumnReorder=@FormatSettings.AllowColumnReorder AllowColumnPicking=@FormatSettings.AllowColumnPicking
                           Density=@FormatSettings.FormDensity Sort="@Reset" Page="@Reset" Filter="@Reset" RowDoubleClick="@EditRowDbl"
                           SelectionMode="DataGridSelectionMode.Single" @bind-Value=@selectedProjects>
               <HeaderTemplate>
                   <RadzenButton Icon="add_circle_outline" Text="Add" Click="@InsertRow" title="Add new Project" Variant="Variant.Flat" />
                   <RadzenButton Icon="history" Text="History" Click="@ShowHistory" title="Show History for this row" Variant="Variant.Flat" Shade="Shade.Lighter" Disabled="@(selectedProjects.Count == 0)" />
                   <RadzenButton Icon="get_app" Text="Export" Click="@ExportClick" Variant="Variant.Flat" Shade="Shade.Lighter" title="Export data to excel" />

               </HeaderTemplate>

               <Columns>
                   <RadzenDataGridColumn Context="project" Filterable="false" Sortable="false" TextAlign="TextAlign.Center" Frozen="true" FrozenPosition="FrozenColumnPosition.Left" Width="90px">
                       <HeaderTemplate>
                           <RadzenButton Icon="filter_alt_off" Click=@(() => { projectGrid.Reset(); StateHasChanged(); }) Size="ButtonSize.Medium" Shade="Shade.Lighter" title="Clear all filters" />
                       </HeaderTemplate>
                       <Template Context="project">
                           <RadzenButton Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Small" Click="@(args => EditRow(project))" @onclick:stopPropagation="true" />
                           <RadzenButton Icon="delete" ButtonStyle="ButtonStyle.Danger" Variant="Variant.Flat" Size="ButtonSize.Small" Shade="Shade.Lighter" Click="@(args => DeleteRow(project))" @onclick:stopPropagation="true" />
                       </Template>
                   </RadzenDataGridColumn>

                   @foreach (var column in columns)
                   {
                       switch (column.AttributeDtmName)
                       {
                           case DtmConstants.Date:
                               <RadzenDataGridColumn @key=@column.ColumnName Title="@column.ColumnTitle" Property="@column.ColumnName" FormatString=@FormatSettings.DateFormat Type="typeof(DateTime?)" Width="@column.ColumnWidth">
                                   <Template>
                                       @context[@column.ColumnName]
                                   </Template>
                               </RadzenDataGridColumn>
                               break;
                           case DtmConstants.Decimal:
                               <RadzenDataGridColumn @key=@column.ColumnName Title="@column.ColumnTitle" Property="@column.ColumnName" FormatString="@column.ColumnFormat" TextAlign="TextAlign.Right" Type="typeof(decimal?)" Width="@column.ColumnWidth">
                                   <Template>
                                       @context[@column.ColumnName]
                                   </Template>
                               </RadzenDataGridColumn>
                               break;
                           case DtmConstants.Integer:
                               <RadzenDataGridColumn @key=@column.ColumnName Title="@column.ColumnTitle" Property="@column.ColumnName" FormatString="@column.ColumnFormat" TextAlign="TextAlign.Right" Type="typeof(int?)" Width="@column.ColumnWidth" Visible="@column.ColumnVisible">
                                   <Template>
                                       @context[@column.ColumnName]
                                   </Template>
                               </RadzenDataGridColumn>
                               break;
                           default:
                               if (column.ColumnSorted)
                               {
                                   <RadzenDataGridColumn @key=@column.ColumnName Title="@column.ColumnTitle" Property="@column.ColumnName" Width="@column.ColumnWidth" SortOrder="0" Frozen="true" Type="typeof(string)">
                                       <Template>
                                           @context[@column.ColumnName]
                                       </Template>
                                   </RadzenDataGridColumn>
                               }
                               else
                               {
                                   <RadzenDataGridColumn @key=@column.ColumnName Title="@column.ColumnTitle" Property="@column.ColumnName" Width="@column.ColumnWidth" Type="typeof(string)">
                                       <Template>
                                           @context[@column.ColumnName]
                                       </Template>
                                   </RadzenDataGridColumn>
                               }
                               break;
                       }

                   }


               </Columns>
           </RadzenDataGrid>

Any help would greatly be appreciated as I realy like your components
type or paste code here

The latest version of Radzen.Blazor is 6.1.5 - do you have exception with latest as well?

Hi, 6.1.4 is the highest version I see in nuget and it fails

6.1.5 was released earlier today:

Let us know how to replicate the problem - you can use our demos to replicate your case, they are editable.

You can also compare your implementation with our dynamic data demo:

Hi, I used the demo example in my app and eventually found what I was doing wrong.

I was not using Property="@PropertyAccess.GetDynamicPropertyExpression(column.ColumnName, typeof(string))"

to set my property but was assigning column name like a non dynamic grid.

Thanks for pointing me in the right direction