Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
When I am loading the listbox in edit view after clicking edit link I am getting the exception
" The parameter 'expression' must evaluate to an IEnumerable when multiple selection is allowed"
ASP.NET
<%: Html.ListBoxFor(model => model.PCBECSId,
 new MultiSelectList(ViewData["Selpcba"] as IEnumerable,
 "PCBAId", "ECSPCBAId", ViewData["pcbaDDindex"] as IEnumerable),
 new { id = "Pcbalstbox" })%>

Please help on this to overcome.

What I have tried:

I am writing the code to bind the list box for multi selection as the above mentioned code is working in MVC2 and not working in MVC4
Posted
Updated 1-Apr-16 7:48am
v2

1 solution

Hello,

Please see the following SO links. These discussions will surely help.
jquery - ListBoxFor with single selection in asp.net mvc[^]

c# - Getting error at time of binding ListBoxFor control in MVC4[^]

Second link explains better. :)
Thanks
 
Share this answer
 
Comments
Member 8557048 25-Apr-16 5:58am    
Thanks for your help
Passion4Code 25-Apr-16 8:53am    
You are welcome. Accept answer if this has actually helped to solve your problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900