Last Updated: 30 Jan 2020 14:48 by ADMIN
Release 2.6.1
Created on: 06 Jun 2019 10:49
Category: Grid
Type: Bug Report
Filterable column without Field throws a null exception

If the grid has Filterable=true, at the moment, all columns must have a Field defined. If a column does not have a Field, an exception similar to this one will be thrown:

Error: System.ArgumentNullException: Value cannot be null.
Parameter name: name
   at System.Type.GetProperty(String name, BindingFlags bindingAttr)
   at Telerik.Blazor.Components.Grid.TelerikGridFilterHeaderBase`1.get_PropInfo()
   at Telerik.Blazor.Components.Grid.TelerikGridFilterHeaderBase`1.get_PropType()
   at Telerik.Blazor.Components.Grid.TelerikGridFilterHeaderBase`1.get_PropTypeName()
   at Telerik.Blazor.Components.Grid.TelerikGridFilterHeaderBase`1.ResetFilterText()
   at Telerik.Blazor.Components.Grid.TelerikGridFilterHeaderBase`1.OnInit()
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()

Instead, when no Field is provided, filtering, sorting and other operations that require a model field must be disabled internally without an exception.

For the time being, a workaround is to set Filterable=false to the desired column.

Here is an example where the workaround is highlighted

@using Telerik.Blazor.Components.Grid
@using Telerik.Blazor.Components.Button
<TelerikGrid data="@Histories" height="600px" Pageable="true" PageSize="20" Sortable="true" Filterable="true">
        <TelerikGridColumn Field="Casecode" />
        <TelerikGridColumn Field="Historytext" />
        <TelerikGridColumn Field="Createdate" Title="Create Date" />
        <TelerikGridColumn Filterable="false">
                    var CurrentRecord = context as CaseHistory;
                    if (CurrentRecord.Blobid > 0)
                        <TelerikButton OnClick="@(() => MyCustomCommand(CurrentRecord))">Open</TelerikButton>
@functions {
    public class CaseHistory
        public int Id { get; set; }
        public int Casecode { get; set; }
        public string Historytext { get; set; }
        public DateTime Createdate { get; set; }
        public int Blobid { get; set; }
    IEnumerable<CaseHistory> Histories = Enumerable.Range(1, 50).Select(x => new CaseHistory
        Id = x,
        Casecode = x,
        Historytext = "text " + x,
        Createdate = DateTime.Now.AddDays(-x),
        Blobid = (x % 3 == 0) ? x : -x
    string result { get; set; }
    void MyCustomCommand(CaseHistory itm)
        result = $"custom command fired for {itm.Id} on {DateTime.Now}";