I have 2 lists in my Viewmodel:
...
public List<District> SelectedDistricts { get; set; }
public List<District> DistrictSelected { get; set; }
...
(The SelectedDistricts and the DistrictSelected are equal.)
and I'd like this:
@Html.DropDownListFor(m => m.SelectedDistricts, new MultiSelectList(Model.SelectedDistricts, "uId", "cName"), new { multiple = "multiple", @class = "form-control" })
@Html.DropDownListFor(m => m.DistrictSelected, new MultiSelectList(Model.SelectedDistricts, "uId", "cName", Model.SelectedDistricts.Select(y => y.uID).ToArray()), new { multiple = "multiple", style = "display:none;" })
My problem the options of the second listbox are not selected on the page.