asp.net mvc 3 listbox -


i'm trying add multiple selectlist, creation work fine modification selected values data base failed show them in page, controller 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; 

and view code:

<%:html.listbox("listeentites", viewdata["listeentites"] multiselectlist, new { size = "4" })%> 

you populating selectedvalues values datatextfield of select list - need populating datavaluefield:

foreach (entite e in liste) {     selectedvalues.add(e.id); } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -