Skip to content

Instantly share code, notes, and snippets.

@geistchevalier
Created October 10, 2019 06:07
Show Gist options
  • Save geistchevalier/fb6c7bc985644ee95fdff7f2a36219a0 to your computer and use it in GitHub Desktop.
Save geistchevalier/fb6c7bc985644ee95fdff7f2a36219a0 to your computer and use it in GitHub Desktop.
[Telerik Kendo UI][dotnet core 2.x] Grid not showing data
// I was getting an empty grid even though the POST request returned a [200] response
// and there was data in the response body when I checked the browser console.
//
// Turns out .NET Core MVC has a behavior of formatting anything that passes the Json() function to be camelCased.
// Telerik Kendo was probably looking for something like "response.Data" but the response gave "response.data", note the lowercase
// Go to your Startup.cs in your project and add the following to the MVC services
services.AddMvc()
.AddJsonOptions(option => option.SerializerSettings.ContractResolver = new DefaultContractResolver()); // Add JsonOptions
// If camelCase was the issue, it should be solved
// I wasted half a day to figure what was wrong since no error was thrown, hope it helps whoever needs this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment