I am getting null values in the controller. Not sure what am I am missing.
I have a grid where I have a list of guests (with name & email) where user select gues
Maybe changing setting traditional to true might help. Here is (modified) code that I used to post unique identifiers (Guids) to the controller action.
var yourArray = new Array();
// TODO: fill array with ids of checked checkboxes
$('.CBC:checked').each(function () {
yourArray.push($(this).attr('myId'));
});
var postData = {
yourArray: yourArray
};
$.ajax({
type: "POST",
url: "/ctrl/ActionName",
data: postData,
success: function (result) {
},
datatype: "json",
traditional: true
});
In the controller I have following action.
[HttpPost]
public ActionResult ActionName(List yourArray)
{
return View();
}