DataGrid sorting and filtering stopped working

Hello,

All of the actions in DataGrid suddenly stopped working.

Stack trace:

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Linq.Dynamic.Core.Parser.KeywordsHelper..ctor(ParsingConfig config)
at System.Linq.Dynamic.Core.Parser.ExpressionParser..ctor(ParameterExpression[] parameters, String expression, Object[] values, ParsingConfig parsingConfig)
at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(Type delegateType, ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values)
at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values)
at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, Type itType, Type resultType, String expression, Object[] values)
at System.Linq.Dynamic.Core.DynamicQueryableExtensions.Where(IQueryable source, ParsingConfig config, String predicate, Object[] args)
at System.Linq.Dynamic.Core.DynamicQueryableExtensions.Where[Radnik](IQueryable1 source, ParsingConfig config, String predicate, Object[] args) at System.Linq.Dynamic.Core.DynamicQueryableExtensions.Where[Radnik](IQueryable1 source, String predicate, Object[] args)
at Radzen.QueryableExtension.Where[Radnik](IQueryable1 source, IEnumerable1 columns)
at Radzen.Blazor.RadzenDataGrid1[[WebApp.Pages.Index.Radnik, WebApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_View() at Radzen.PagedDataBoundComponent1[[WebApp.Pages.Index.Radnik, WebApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].get_PagedView()
at Radzen.Blazor.RadzenDataGrid1[[WebApp.Pages.Index.Radnik, WebApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].DrawGroupOrDataRows(RenderTreeBuilder builder, IList1 visibleColumns)
at Radzen.Blazor.RadzenDataGrid1.<>c__DisplayClass6_0[[WebApp.Pages.Index.Radnik, WebApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<DrawRows>b__0(RenderTreeBuilder builder) at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment) at Radzen.Blazor.RadzenDataGrid1[[WebApp.Pages.Index.Radnik, WebApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].BuildRenderTree(RenderTreeBuilder __builder)
at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

Razor component:

<RadzenDataGrid Data="@_radnici" TItem="Radnik" AllowSorting="true" AllowFiltering="true" FilterMode="FilterMode.Simple"
                FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" EmptyText="Нема резултата.">
    <Columns>
        <RadzenDataGridColumn TItem="Radnik" Property="Id" Title="Запослени ИД" />
        <RadzenDataGridColumn TItem="Radnik" Property="Ime" Title="Име" />
        <RadzenDataGridColumn TItem="Radnik" Property="Prezime" Title="Презиме" />
    </Columns>
</RadzenDataGrid>

@code {
    private IEnumerable<Radnik> _radnici;

    protected override void OnParametersSet()
    {
        _radnici = new List<Radnik>()
    {
            new Radnik() {Id = 1, Ime="Petar", Prezime = "Petrovic"},
            new Radnik() {Id = 2, Ime="Marko", Prezime = "Markovic"}
        };
    }

    private class Radnik
    {
        public int Id { get; set; }
        public string Ime { get; set; }
        public string Prezime { get; set; }
    }
}

Thank you.

Any info about DataGrid settings?

For some reason Grid settings are not shown here.

You can use markdown for code in our forum, check the forum FAQ for reference. I’ve edited your first post.

1 Like

I've tested your grid and everything worked normally on my end:

Hi @enchev

I found out that bug only occurs after my app gets authenticated using Identity server 4. When I allow anonumous access all data grid features work as expected.

I am new to Radzen components, so am I missing something about security related data grid stuff?

Thank you

Hi @stefanmitic ,

There is no security related code in the DataGrid, most probably some code in your application is crashing - you can use Visual Studio to debug it.