I’m having problems with getting items in a multiselect to get selected.
I have this:
BookingObject bo = _bs.GetBookingObjects(bookingobjectID.Value).FirstOrDefault();
bo.BookingViews.Load();
MultiSelectList BookingViewsBookingObjects = new MultiSelectList(_bvs.GetBookingViews(), "BookingViewID", "BookingViewName", (IEnumerable<BookingView>)bo.BookingViews.ToList());
BookingViews <-> BookingViewsBookingObjects <-> BookingObjects
Its a many to many relationship. _bvs.GetBookingViews() returns IQueryable of BookingView, and I cant seem to get the items from bo.BookingViews selected.
What might be missing here? am I using the wrong type?
/M
Maybe you need to send the actual selected value in the last parameter the “BookingViewID” instead of the
IEnumerable<BookingView>as a holeIEnumerable<object>it will be anIEnumerable<int>if BookingViewID is int, something like:EDIT: Full Code.
SetUp the Data(Controller/ViewModel):
(View):
The Result:
alt text http://www.diarioplus.com/files/pictures/multiselectlist.JPG