Reputation: 3697
I'm currently try to use the JQuery Datatables in my Project. This seem to work quite well, but I have problems to process the Ajax request for removing a row.
The Ajax request that is send by the datatables Editor plugin is formatted like:
action=remove&table=pzeIpMaster&id=&data%5B%5D=3
The method in the controller looks like
[Authorize, HttpPost]
public ActionResult OnDeletePzeMaster(
string action, string table, string id, string[] data)
The values of the parameters are
Why is data set to null ?!! In my opinion data must be set to {3}
Thx for your help
Upvotes: 2
Views: 428
Reputation: 1245
data%5B%5D decodes to data[]. So MVC can't match data[] with yor data parameter.
You could try this:
[Authorize, HttpPost]
public ActionResult OnDeletePzeMaster(
string action, string table, string id)
{
var data = this.Request.Form["data[]"];
}
Or you could write a ModelBinder like this
ASP.NET MVC - Custom model binder able to process arrays
Upvotes: 2