Lasse Edsvik
Lasse Edsvik

Reputation: 9298

MultiSelectList problem

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

Upvotes: 1

Views: 312

Answers (1)

Vinay Sajip
Vinay Sajip

Reputation: 99355

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

Upvotes: 2

Related Questions