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

asp.net core 3.1 with AspNetzero - grid not binding to data when called from Ajax

1 Answer 187 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Prakash
Top achievements
Rank 1
Prakash asked on 20 Mar 2020, 12:10 AM

The grid definition in asp.net mvc core chtml

index.cshtml
@(Html.Kendo().Grid<COSalesDto>()

.Name("grid")

.Columns(columns => { columns.Bound(p => p.CatalogNumber); columns.Bound(p => p.UsageCode).Width(150); })

Pageable() .Sortable() .Filterable()

.DataSource(dataSource => dataSource

       .Ajax() .PageSize(20)

     .Read(read => read.Action("ChangeOrder_Read", "Naco"))

).Deferred() )  

Here is my data returned from ajax call

{ "Data": [ { "CatalogNumber": "Catalog 12345", "UsageCode": "Usage Code 1" }, { "CatalogNumber": "Catalog 8234758", "UsageCode": "Usage Code 2" } ], "Total": 0, "AggregateResults": null, "Errors": null }

all events are triggering on grid, but no data binding happening.  Here is my entry in startup

Startup.cs

services.AddControllersWithViews(options => { options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute()); })

.AddJsonOptions(options => { options.JsonSerializerOptions.PropertyNameCaseInsensitive = true; options.JsonSerializerOptions.PropertyNamingPolicy = null; }) 

Any help greatly appreciated.
Thanks V


1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 24 Mar 2020, 03:02 PM

Hello Prakash,

Thank you for the code snippet. 

On my side, the data is binding correctly if I remove the Deffered() method, which will suppress the immediate rendering of the script statements. Attached you will find a project for reference based on the provided code snippet. If removing the Deffered method does not resolve the issue, could you please modify the project to reproduce the issue? I will then debug it and happily assist you.

Looking forward to your reply.

Regards,
Martin
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.
Tags
Grid
Asked by
Prakash
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or