This is a migrated thread and some comments may be shown as answers.

Grid does not render output using Page model ASP.NET Core 3.1

2 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 23 Mar 2020, 02:06 AM

 

Using ASP.NET Core 3.1 Razor Pages

 

Page Model:

        public IList<Label> Label { get;set; }

        public async Task OnGetAsync()
        {

            Label = await _context.Labels
                .ToListAsync();

       }

Page: This renders no output at all on the Razor page even though debugging shows records in Model.Label.

I've also noticed that the standard table bound to the same data will work until this code is added to the page, it then also renders nothing. Other controls work fine.

@(

    Html.Kendo().Grid(Model.Label)
    .Name("label-grid")
    .Columns(columns =>
    {
        columns.Bound(c => c.ProductId).Title("Item");
        columns.Bound(c => c.Template);
        columns.Bound(c => c.Family);
        columns.Bound(c => c.ProductLine);
        columns.Bound(c => c.EdgeDetail);
        columns.Bound(c => c.GridSize);
        columns.Bound(c => c.Size);
    })

)

2 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 25 Mar 2020, 12:18 PM

Hello Mark,

I tested with some dummy data, but I was unable to reproduce the described problem. 

I am attaching a sample project to take a look. 

Regards,
Ianko
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Mark
Top achievements
Rank 1
answered on 27 Mar 2020, 05:12 PM
I was able to resolve this issue. It seems the issue was that I was using the actual model entity which was evidently too complex. I used a simplified ViewModel version of the entity and it works. Thanks
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Mark
Top achievements
Rank 1
Share this question
or