How to load server-side data in ASP.NET MVC ?

How to load server-side data in ASP.NET MVC ?

fa2020fa2020 Posts: 4Questions: 3Answers: 0
edited January 2022 in DataTables

I'm trying to use server-side data loading to fill the table. My view is:


Controller code:

The result is:

The output Json which controller returns is:

What is wrong in my code?

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    I was worried that the columnDefs after columns would cause an issue, but as you can see here, that's fine. Everything looks like it should work, though this thread may be an issue if you have backslashes in your returned data.

    If that doesn't help, could you link to your page so we can debug please,

    Colin

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Your columns array is inside the ajax object, which is going to be at least part of the issue.

    Also you'll need to use ajax.dataSrc set to an empty string to tell DataTables to expect a plain array of data, rather than being wrapped in an object.

    Allan

Sign In or Register to comment.