0
我有这样的考虑“指数”:问题通过数据模型,查看
<ul>
@foreach (var r in Model.Where(c => c.id_parent == null)) {
<li>
@Html.DisplayFor(i => r.node.name)
@if (r.node.children.Count > 0) {
<ul>
@{Html.RenderPartial("aView", r.node);}
</ul>
}
</li>
}
</ul>
但要上的RenderPartial行此错误:
The model item passed into the dictionary is of type 'System.Data.Entity.DynamicProxies.arrangement_86479E2FE1ED6F9584881D169E310F3C37120A10A806A6CF640967CBCB017966',
but this dictionary requires a model item of type
'System.Collections.Generic.IEnumerable`1[PlanovaniZdroju.Models.arrangement]'.
我怎样才能重新键入r.node IEnumerable?或者我可以如何解决它?
什么是你从控制器传递? – 2011-04-26 10:15:12
@jimmy_keen 'public ViewResult Index() { var roots = db.roots; return View(roots.ToList()); }' – dvdmchl 2011-04-26 10:33:13