How to load server-side data in ASP.NET MVC ?
How to load server-side data in ASP.NET MVC ?
fa2020
Posts: 4Questions: 3Answers: 0
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
I was worried that the
columnDefs
aftercolumns
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
Your
columns
array is inside theajax
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