2
I’m using Razor to generate a SelectList thus:
@Html.DropDownList("StatusImovel", new SelectList(ViewBag.ListaStatus, "IdStatus", "Descricao"), new { @hidden = "hidden", @multiple = "multiple", @form = "nulo" })
I need it to load already with some selected items, so I’m trying this:
@Html.DropDownList("StatusImovel", new SelectList(ViewBag.ListaStatus, "IdStatus", "Descricao", ViewBag.StatusSelecionados), new { @hidden = "hidden", @multiple = "multiple", @form = "nulo" })
Whereas ViewBag.StatusSelecionados is a array int[] with the IdStatus that I want.
but it’s not working.
There’s some way to do it?
Good Leandro! It worked. Thank you.
– AlamO
@Alamo then scores as the answer :)
– Leandro Angelo