MVC 4 - Use a different model in partial view

前端 未结 4 428
走了就别回头了
走了就别回头了 2021-02-05 02:51

Please bear with my noobness, I\'m super new to the MVC pattern.

What I\'m trying to do

I am building a profile information page for re

4条回答
  •  离开以前
    2021-02-05 03:21

    There is an overload of @Html.Partial which allows you to send ViewData as defined in your controller - this is the method I generally use for partial views. In your controller define ViewData["mypartialdata"] as ViewDataDictionary. Then in your view

    @Html.Partial("_ModifyProfileInfo",ViewData["mypartialdata"])
    

提交回复
热议问题