Cannot Get Any Data to Load in Grid
Environment
Product | Progress® Telerik® UI Grid for ASP.NET Core |
Operating System | All |
Browser | All |
.NET Framework | Version 1 0 |
Description
When the Grid data is sent from the Controller to the client and I cannot get any records to load in any of the grids in my ASP.NET Core project. What is the cause and how can I handle this issues?
Cause
By default, the data in .NET Core is serialized in camelCase, while the property names in the Model are usually in PascalCase. As a result, in this scenario the DataSource of the Grid does not recognize the fields in the data that is returned by the server.
Solution
Edit the ConfigureServices
method in the Startup.cs
.
public void ConfigureServices(IServiceCollection services)
{
...
// Maintain property names during serialization. See:
// https://github.com/aspnet/Announcements/issues/194
services
.AddMvc()
.AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null);
// Add Kendo UI services to the services container
services.AddKendo();
}