I'm trying to do a multiple selection with ListBoxFor of Razor, but the select does not allow me to select multiple items (I can do that only selecting my items with Ctr+click the second item). I've reduced my code to minimal like the exemple shown in this answer (my code is above). Anyone can help me?? I'm desperate.
My Model
public IEnumerable<int> ParoleChiave { get; set; }
public IEnumerable<SelectListItem> ListaParoleChiave { get; set; }
My Controller
model.ListaParoleChiave = new List<SelectListItem>() {
new SelectListItem(){ Text = "Pro", Value = "2"},
new SelectListItem(){ Text = "Test", Value = "3"}
};
My View
<div class="form-group form-group-sm">
<label class="col-xs-12">Parole chiave</label>
<div class="col-xs-12">
@Html.ListBoxFor(m => m.ParoleChiave, Model.ListaParoleChiave, new { @class = "form-control", style = "width: 100%" })
</div>
</div>