New to Telerik UI for ASP.NET Core? Download free 30-day trial

Cannot Get Any Data to Load in Grid

Environment

Product Grid for Progress® Telerik® UI for ASP.NET Core

Description

When the Grid data is returned from the Controller to the client, it is impossible to get any records and load them in any of the Grids in my ASP.NET Core project. What is the cause for this issue and its solution?

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 file.

    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();
    }

More ASP.NET Core Grid Resources

See Also

In this article