2
I am using Asp.net C# with mvc 4 and in my View I have a Dropdownlistfor, with a class I used of bootstrap-multiselect, as in the image:
And the code in the view:
@Html.DropDownListFor(m => m.Estagios, (IEnumerable<SelectListItem>)Model.Estagios, new { @class = "multiselect form-control", multiple = "multiple" })
When I do the search, I do a Post in a method in the Controller and within that method (both get and post) feed the Viewmodel and the Selectlist:
So, he’s taking the values I posted, which are 1, 3 and 5. I give a Return View passing to Viewmodel. When he posts and the page reloads, he assumes the value in the right querystring and does all the processing of the right search as programmed, but he does not assume the values selector in Dropdownlist, bringing only the first of the list:
I’m doing something wrong?
The plugin used for css/javascript is this: davidstutz.github.io/bootstrap-multiselect
I managed to, but I made some changes to what you gave me. In the controller I kept: Viewmodel.Interns = new Selectlist(_internsService.Listings(), "Interns", "Names", interns); In View: @Html.Listbox("Interns", Model.Interns, new { @class = "multiselect-group-clickable" }) I put the Jquery function that you passed and worked correctly. Thank you so much for your help!
– RafaelMoura
If you think it helped, you can take it as an answer, please.
– Lucas