asp.net mvc 3 listbox

Arronoevedive

New Member
I'm trying to add a multiple \[code\]selectlist\[/code\], for the creation it work fine but for the modification I get the selected values from data base but I failed to show them in my page, this is my controller code \[code\]IList<Entite> liste = articleDAO.GetById(id).Entites;ICollection<string> selectedValues = new List<string>();foreach (Entite e in liste) { selectedValues.Add(e.NomEntite);}MultiSelectList entites = new MultiSelectList(entitesDAO.GetAll(), "Id", "NomEntite", selectedValues);ViewBag.listeEntites = entites;\[/code\]and this is my view code:\[code\]<%:Html.ListBox("listeEntites", ViewData["listeEntites"] as MultiSelectList, new { size = "4" })%>\[/code\]
 
Back
Top