Solved: jQuery datatable server-side processing .net Core

Issue: In .net core when you create data grid by using jQuery datatable, directly its not working because of our model property names, we need to setup in startup.cs.

you can follow this code.

Do in Startup.cs file on return data if you are use camelCase then use this.

public void ConfigureServices(IServiceCollection services)
    {   
        services.AddControllersWithViews()
        .AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver =     
         new CamelCasePropertyNamesContractResolver());

if you are use pascal case

public void ConfigureServices(IServiceCollection services)
    {   
        services.AddControllersWithViews()
        .AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver =     
         new DefaultContractResolver());

For more info follow this url.

https://stackoverflow.com/questions/55286638/jquery-datatable-server-side-processing-net-core/63508635#63508635

Leave a Comment