After adding Telerik UI for ASP.NET MVC the DataTables I had before stopped working

0 Answers 80 Views
Grid
David
Top achievements
Rank 1
David asked on 13 Oct 2022, 09:58 PM | edited on 14 Oct 2022, 12:38 AM

Problem discovered....now I need some help fixing

 

I added Telerik to a project of mine today and everything looked fine. My project uses IdentityManagerUI and I use Datatables to display the Roles and Users for adding editing, etc.

I went to check a role and DataTables through up a cryptic error "DataTables warning: table id=usersTable - Requested unknown parameter 'id' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4

I take Telerik back out of the project and everything is fine. Add it back in and I get the same error.

I am currently working in an MVC Core .NET 6 environment using EF6 and all that. I have looked everywhere to see what has changed and I can't find anything. I've stripped down the view to not include js or css from wwwroot or layouts, making sure I'm only using the Kendo references and I still have the problem

Anyone ever have this problem or have an idea of where I should look to see what's going on?

Thanks!!

 

David
Top achievements
Rank 1
commented on 14 Oct 2022, 12:32 AM

I have discovered the problem. In the following code I get the error for DataTables. This is the additional services Kendo/Telerik needs to work. If I comment out the .AddNewtonsoftJson everything returns back to normal and works.

services.AddControllersWithViews()

    // Maintain property names during serialization. See:
    // https://github.com/aspnet/Announcements/issues/194
    .AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver =  new Newtonsoft.Json.Serialization.DefaultContractResolver());

services.AddKendo();

 

What do you think is my solution is here? I am very new to .NET Core and this whole services thing is new to me. I really want to continue using the DataTables and not convert because there are so many of them, but I also want to learn and use Kendo because of it features.

Thanks

Alexander
Telerik team
commented on 18 Oct 2022, 12:07 PM

Hi David,

Thank you for sharing the current solution with the community, it is greatly appreciated. The issue that you are facing may be caused by the JSON Serialization configuration that is used for the property name casing of data-bound components. Having this in mind, if the serializer changes the casing to camelCase, but PascalCase is inspected instead, the component will not bind to the data resulting in an unsuccessful attempt to display it.

You can review the following article that can be used as a point of reference:

Finally, the Telerik UI for ASP.NET Core has its own getting started to experience in a Virtual Classroom more of which can be found here:

That being on an external note, I would also recommend reviewing the following resource that goes more in-depth about the ASP.NET Core architecture as a whole that might be helpful as well:

I hope this information proves useful.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
David
Top achievements
Rank 1
Share this question
or