I am trying to retrieve multiple selected values from my ListBox in MVC4. Using the code below I can only retrieve the first value and rest of the selected values does not show up in the ActionResult function.
Not sure what's wrong. Would be great if someone can help as I can not find any online posts on this specific issue. Thanks
I have following html, Jquery and c# code:
@Html.ListBoxFor(m=>m.id, Model.Codes)
$("#ListBoxID").change(function () {
if ($(this).val() != "") {
$("#div").load('actionfunction', {
data: $('#ListBoxID').val(),
});
}
});
public ActionResult actionFunction(string data)
{
// code here BUT
}