开发者

Problem to pass data model to view

I have this in view "Index":

<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>

But getting this error on the RenderPartial line:

    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]'.

How can I retype the r.node to IEnumerable? OR how else can I solve it?


Are you sure you didn't mean:

<ul>
    @{Html.RenderPartial("aView", r.node.children);}
</ul>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜