简体   繁体   中英

ASP.NET MVC 3 Controller or View Engine

Lets say I render a partial view within some view (using @Html.RenderPartial("")). Does the controller look for this partial or is it the ViewEngine? Assume the partial view doesn't exist in the controller's Home area. This is so confusing.

Contrary to the Html.RenderAction helper, for Html.RenderPartial it is the view engine which will look for the corresponding partial view and include it at the specified location in the main View. There's no controller involved in this process. And if the partial view doesn't exist in the controller's home area you could always specify the full path to it:

@Html.RenderPartial("~/Views/Foo/Bar")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM