MVC3 - Passing data beyond the model to Partial view

后端 未结 4 432
天命终不由人
天命终不由人 2021-01-30 13:18

Is there a way to pass a piece of extra data along with a model to a Partial view?

E.G.

@Html.Partial(\"_SomeTable\", (List)ViewBag.Tabl

4条回答
  •  轮回少年
    2021-01-30 13:51

    You can get even clever as shown here by Craig Stuntz

    Html.RenderPartial("SomePartialView", null, 
        new ViewDataDictionary(new ViewDataDictionary() { {"SomeDisplayParameter", true }})
            { Model = MyModelObject });
    

提交回复
热议问题