I have a jQuery Datatable that renders 1500 rows at the client side. My User checks the rows and then I send the Ids of selected rows and save the data.
This is working fine for the first 1000 rows but any time more than that is checked the data does not seem to be getting posted - on Dev Tools the call to MVC controller shows a 500 internal server error but with a breakpoint on the method it doesn't get hit?
If I have 1000 rows selected the breakpoint gets hit and all 1000 ids are passed. Once I add 1 more row to be checked the breakpoint doesn't get hit but I see 500 internal server error on Dev Tools?
My code is below:
$('#saveBtn').click(function () {
var dataArr = [];
var rows = $('tr.selected');
var rowData = myTable.rows({ selected: true }).data();
$.each($(rowData), function (key, value) {
dataArr.push(value[0]); //Id is hidden in 1st column of the table
});
$.ajax({
type: 'POST',
url: '@Url.Action("SaveData", "MyController")',
data: JSON.stringify(dataArr),
contentType: 'application/json; charset=utf-8',
success: function (data) {
location.reload();
},
error: function () {
sweetAlert("Error Occurred Saving");
location.reload();
},
});
});
My MVC Controller is pretty straight forward
[HttpPost]
public ActionResult SaveData(List<int> Ids)
{
//private method that just calls to the DB and sets a flag to say that Id was checked
SaveData(Ids);
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
I have tried to add the below to my MVC Web config but I still dont get breakpoint hit when I select more than 1000
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483644"/>
</webServices>
</scripting>
</system.web.extensions>