asp.net mvc - pass partial data model to partial view

后端 未结 2 1956
轮回少年
轮回少年 2021-02-08 23:51

I wish to build a partial view that gets a model column and print it. Something like that:

At the view:

@model IEnumerable

        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-09 00:12

    For 1 try changing @Html.RenderPartial("_DisplayAttribute",Brand) to @Html.Partial("_DisplayAttribute",Brand)

    You will also need to specify the model in the partial view like @model products_comparison.Models.Brand or something like it

    Also please clarify 2 & 3 as they are not clear what you want

提交回复
热议问题