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

All grids stopped showing the data

8 Answers 611 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Reid
Top achievements
Rank 2
Reid asked on 16 Apr 2018, 07:00 PM

I have like 17 grids on templates that display and service the CMS portion of a site.  Until I noticed today, all grids were functioning fine for display and crud operations.  Now the grids do not show the data.

I can put a breakpoint at the end of the read function and see that the data is there.

IQueryable<Product> res = viewModel.Products.AsQueryable<Product>();
DataSourceResult data = res.ToDataSourceResult(request);           
JsonResult result = Json(data);
 return Json(data);

 

So as the Read functions exit they have their data but the grids do not display anything!  I have been working in an entirely different area on the retail part of the site over the last few days that has nothing to do with Telerik and have not changed any of the code on that controller or associated views that have to do with the CMS portion.  I am completely stumped on this one

Any suggestions would greatly help.  This is an important issue that has the CMS side of the site down.

Thanks

 

 

 

 

 

8 Answers, 1 is accepted

Sort by
0
Reid
Top achievements
Rank 2
answered on 18 Apr 2018, 09:50 AM

I discovered the problem. First of all this application is an ASP.NET MVC Core application and initializes the application and container in the Startup.cs.  In the service configuration section I altered something in trying to resolve a serialization/deserialization issue.  After adding back the DefaultContractResolver in the option settings for JSON the data returned to the display.

 services.AddMvc()
 // Maintain property names during serialization.  
 .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());

 

 

0
Accepted
Viktor Tachev
Telerik team
answered on 18 Apr 2018, 12:25 PM
Hello Reid,

The most likely cause of the behavior you are seeing is the way data is serialized by .NET Core. By default the fields will be serialized in camelCase and the Grid component will usually expect them to be in PascalCase. In order to avoid this it is recommended to change the serialization settings.

Please check out step 5 in the article below that shows how you can configure the option.



Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Reid
Top achievements
Rank 2
answered on 20 Apr 2018, 10:43 AM
Thanks for this response.  That article covers this topic well.
0
Chayady
Top achievements
Rank 1
answered on 02 Jan 2020, 04:46 AM

Dear Viktor,

Is your answer (and the link) still valid (as of 2 Jan 2020)?

The link (step 5) mention about "Add the Kendo UI services to the services container".

I have done that but it still not working.

I have confirmed that json data has been passed, but kendo grid didn't show it.

i.e: json: id: "f9238530-712c-43c8-b1a7-0c0887f7743d" but my column: columns.Bound(p => p.Id);

I am using net core 3.1

Thanks in advance.

0
Chayady
Top achievements
Rank 1
answered on 02 Jan 2020, 05:34 AM

Sorry, found the answer: 

https://www.telerik.com/forums/inline-grid-not-showing-records

https://docs.telerik.com/kendo-ui/knowledge-base/grid-is-not-showing-data

public void ConfigureServices(IServiceCollection services){...// Maintain property names during serialization. See:// https://github.com/aspnet/Announcements/issues/194 services .AddMvc().AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());// Add Kendo UI services to the services container services.AddKendo();}

0
Viktor Tachev
Telerik team
answered on 06 Jan 2020, 01:17 PM

Hello,

 

The structure of the linked article was changed a bit. The relevant information is available in the JSON Serialization section linked below:

https://docs.telerik.com/aspnet-core/getting-started/prerequisites/environment-support#json-serialization

 

Regards,
Viktor Tachev
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
0
s_guryev
Top achievements
Rank 1
answered on 29 Jan 2021, 09:43 PM

Hello Victor.
I have added contract resolver which didn't help

I can see details in the response with the correct case

My grid is so simple:

@(Html.Kendo().Grid<AppUserModel1>()
.Name("grid_users1")
.Height(200)
.Columns(columns =>
{
columns.Bound(m => m.Email);
})
.DataSource(ds => ds
.Ajax()
.Model(m =>
{
m.Id(u => u.Id);
m.Field(u => u.Email).Editable(false);
})
.Read(r => r.Action("Get", "User").Type(HttpVerbs.Get))
.Update(u => u.Action("Put", "User").Type(HttpVerbs.Put))
)
.Deferred())

0
s_guryev
Top achievements
Rank 1
answered on 30 Jan 2021, 04:36 PM
My bad. I have forgotten await before returning ToDataSourceResult
Tags
Grid
Asked by
Reid
Top achievements
Rank 2
Answers by
Reid
Top achievements
Rank 2
Viktor Tachev
Telerik team
Chayady
Top achievements
Rank 1
s_guryev
Top achievements
Rank 1
Share this question
or