Render partial from different folder (not shared)

前端 未结 10 2017
名媛妹妹
名媛妹妹 2020-11-29 17:12

How can I have a view render a partial (user control) from a different folder? With preview 3 I used to call RenderUserControl with the complete path, but whith upgrading to

10条回答
  •  难免孤独
    2020-11-29 17:28

    In my case I was using MvcMailer (https://github.com/smsohan/MvcMailer) and wanted to access a partial view from another folder, that wasn't in "Shared." The above solutions didn't work, but using a relative path did.

    @Html.Partial("../MyViewFolder/Partials/_PartialView", Model.MyObject)
    

提交回复
热议问题