ASP.NET MVC multiple select dropdown
In your view:
@Html.ListBoxFor(m => m.location_code, Model.location_type)
That's all you need. You're using a ListBox control so it's already a multiple select list.
Then back in your controller you can get the selected items like this:
[HttpPost]
public string SaveResults(List<int> location_code)
{
if (location_code!= null)
{
return string.Join(",", location_code);
}
else
{
return "No values are selected";
}
}