tags:

views:

59

answers:

1

hello

I have a problem to get the values and text of the MultiSelectList to work. It gets rendered as:

<select id="UsergroupID" multiple="multiple" name="UsergroupID"><option>BookingSystem.Data.Models.Usergroup</option><option>BookingSystem.Data.Models.Usergroup</option><option>BookingSystem.Data.Models.Usergroup</option></select>

And in my controller I have:

MultiSelectList UsergroupID = new MultiSelectList(_ug.GetUsergroups(), u.Usergroups);

_ug.GetUsergroups() returns IQueryable, and u.Usergroups is EntityCollection.

Howto fix this? /M

+2  A: 

It looks as if you haven't specified the DataTextField and DataValueField of the MultiSelectList.

Vinay Sajip