lundi 2 mars 2015

Javascript issue: Array of integers recieved as a string at the Web API controller


Why i am getting a string in my web api controller when I am setting the the property as



$("#ProfessionsCheckBoxes input:checked").each(function() {
professionsChecked.push($(this).attr("Id"));
});
$("#SelectedProfessions").val(professionsChecked);


SelectedProfessions is a list of string in my view model. It is really frustrating Like if i check two check boxes, I get in my controller "2,3" at the 0 index of the list i.e: [0] = "2,3". Not not a list like [0] ="2" and [1] = "3"


Note: I am submit the form through an ajax call with form.serialize() method.





Aucun commentaire:

Enregistrer un commentaire