Last Updated: 21 Nov 2023 08:36 by Douglas
Created on: 12 Apr 2022 08:30
Category: Grid
Type: Bug Report
Grid does not support ExpandoObject properties nested in a custom model

I have created a custom model where I added an ExpandoObject and a couple properties to it. The Grid seems to render the data successfully but the data operations are not possible - the nested properties are treated as invalid. Please add support for nested ExpandoObject properties in custom models.




For the time being, there is a workaround that you may try. Use the ExpandoObject directly, do not nest it in the custom model - bind the Grid Data to a collection of ExpandoObject and populate its properties in the OnInitialized.


@using System.Dynamic

<TelerikGrid Data="@Data" 
             Pageable="true" Sortable="true" Groupable="true"
             Resizable="true" Reorderable="true">
            <GridColumn Field="Id" FieldType="typeof(string)" Width="120px" />
            <GridColumn Field="DetailData.PropertyInt" Title="Column A" FieldType="@typeof(int)"  />
            <GridColumn Field="DetailData.ProptertyString" Title="Column B" FieldType="@typeof(string)"/>
            <GridColumn Field="DetailData.PropertyDate" Title="Column C" FieldType="@typeof(DateTime)"/>

@code {
    public ExpandoObject[] Data { get; set; } = Array.Empty<ExpandoObject>();

    protected override async Task OnInitializedAsync()
        Data = new ExpandoObject[]

    private ExpandoObject GetPopulatedExpando(int id)
        dynamic expando = new ExpandoObject();
        expando.Id = id;
        dynamic nested = new ExpandoObject();
        nested.PropertyInt = id;
        nested.ProptertyString = "ID " + id;
        nested.PropertyDate = new DateTime(2022, 4, id);
        expando.DetailData = nested;

        return expando;


1 comment
Posted on: 21 Nov 2023 08:36

Thank you for this work around, it definitely causes messier code though so if this could be fixed that would be ideal.

I have attached some minimal code to assist the replication of the bug using the latest version of telerik blazor as well as .net7.

there are 3 pages trying to replicate the functionality of this article
Blazor Data Binding | Grid for Blazor - Telerik UI for Blazor
based off this repo blazor-ui/grid/binding-to-expando-object at master · telerik/blazor-ui · GitHub.

page1: index - this is the original page, slightly altered so that its using InCell.

page2: nested - this is the minimal page I would expect to be working

page3: nestedWorkAround - this is the working code that was needed to get around the bug that was suggested in this article.

Attached Files: