Render partial view with dynamic model in Razor view engine and ASP.NET MVC 3

前端 未结 7 1252
日久生厌
日久生厌 2020-12-05 09:28

When I try to render a partial view whose model type is specified as:

@model dynamic

by using the following code:

@{Html.Re         


        
7条回答
  •  生来不讨喜
    2020-12-05 09:58

    I had the same problem & in my case this is what I did

    @Html.Partial("~/Views/Cabinets/_List.cshtml", (List)ViewBag.cabinets)
    

    and in Partial view

    @foreach (Shop cabinet in Model)
    {
        //...
    }
    

提交回复
热议问题