I'm trying to use jQuery Datatables 1.10 with server side processing and ASP.NET MVC 5. Unfortunately, Datatables 1.10 writes to the server by serializing a complex hierarchy of objects into a param string (Content-Type: application/x-www-form-urlencoded
), which breaks the MVC ModelBinder.
Is there any way, in MVC, to bind a complex hierarchy of objects passes as a serialized parameter list? Perhaps a custom ModelBinder that someone has written?
Note:
Setting traditional = true
in the ajax
call doesn't work, because that doesn't support hierarchies of objects. I end up with something like:
draw=1&
columns=[object Object]&
columns=[object Object]&
order=[object Object]&
start=0&
length=10&
search=[object Object]
If the data was sent by DataTables as JSON, then I assume all would be well. The issue stems from the fact that the data is sent as a parameter list.
Also Note
Code for wiring up the table:
$("#serverTable").DataTable({
serverSide: true,
ajax: {
url: '/Home/GetTableData',
type: 'POST'
}
});