当允许多个选择时,参数'expression'必须计算为不可数。 [英] The parameter 'expression' must evaluate to an ienumerable when multiple selection is allowed.
本文介绍了当允许多个选择时,参数'expression'必须计算为不可数。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我点击编辑链接后在编辑视图中加载列表框时我得到了例外
参数'表达式'必须评估为IEnumerable当允许多个选择时
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"
<%: Html.ListBoxFor(model => model.PCBECSId,
new MultiSelectList(ViewData["Selpcba"] as IEnumerable,
"PCBAId", "ECSPCBAId", ViewData["pcbaDDindex"] as IEnumerable),
new { id = "Pcbalstbox" })%>
请帮忙解决这个问题。
什么我试过了:
我正在编写代码来绑定列表框以进行多选,因为上面提到的代码在MVC2中工作而不在MVC4
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
推荐答案
您好,
请参阅以下SO链接。这些讨论肯定会有所帮助。
jquery - ListBoxFor在asp.net mvc中进行单一选择 [ ^ ]
c# - 在MVC4中绑定ListBoxFor控件时获取错误 [ ^ ]
第二个链接解释得更好。 :)
谢谢
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
这篇关于当允许多个选择时,参数'expression'必须计算为不可数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文