Razor: @Html.Partial() vs @RenderPage()
2014-04-04 10:19
316 查看
Html.Partial("MyView")Renders the "MyView" view to an MvcHtmlString. It follows the standard rules for view lookup (i.e. check current directory, then check the Shareddirectory). Html.RenderPartial("MyView")Does the same as Html.Partial(), except that it writes its output directly to the response stream. This is more efficient, because the view content is not buffered in memory. However, because the method does not return any output, @Html.RenderPartial("MyView")won't work. You have to wrap the call in a code block instead: @{Html.RenderPartial("MyView");}. RenderPage("MyView.cshtml")Renders the specified view (identified by path and file name rather than by view name) directly to the response stream, like Html.RenderPartial(). You can supply any model you like to the view by including it as a second parameter RenderPage("MyView.cshtml",MyModel) |
相关文章推荐
- MVC3 Razor模板引擎 @RenderBody、@RenderPage、@RenderSection及Html.RenderPartial、Html.RenderAction
- MVC3 Razor模板引擎 @RenderBody、@RenderPage、@RenderSection及Html.RenderPartial、Html.RenderAction
- MVC Razor模板引擎 @RenderBody、@RenderPage、@RenderSection及Html.RenderPartial、Html.RenderAction
- MVC Razor模板引擎 @RenderBody、@RenderPage、@RenderSection及Html.RenderPartial、Html.RenderAction
- MVC @RenderBody、@RenderSection、@RenderPage、@Html.RenderPartial、@Html.RenderAction
- <收录>@RenderBody、@RenderSection、@RenderPage、Html.RenderPartial、Html.RenderAction的作用和区别
- RenderPartial vs RenderAction vs Partial vs Action in MVC Razor
- RenderPartial vs RenderAction vs Partial vs Action in MVC Razor
- @Html.RenderPartial()在razor模板使用
- @RenderBody、@RenderSection、@RenderPage、Html.RenderPartial、Html.RenderAction的作用和区别
- @RenderBody、@RenderSection、@RenderPage、Html.RenderPartial、Html.RenderAction的作用和区别
- MVC中@RenderBody、@RenderSection、@RenderPage、@Html.RenderPartial、Html.RenderAction的作用和区别
- RenderPartial vs RenderAction vs Partial vs Action in MVC Razor
- @RenderBody、@RenderSection、@RenderPage、Html.RenderPartial、Html.RenderAction的作用和区别
- MVC Razor模板引擎 @RenderBody、@RenderPage、@RenderSection及Html.RenderPartial、Html.RenderAction
- RenderPartial vs RenderAction vs Partial vs Action in MVC Razor
- MVC Razor模板引擎 @RenderBody、@RenderPage、@RenderSection及Html.RenderPartial、Html.RenderAction
- MVC4 @RenderBody、@RenderSection、@RenderPage、Html.RenderPartial、Html.RenderAction的作用和区别
- RenderPartial vs RenderAction vs Partial vs Action in MVC Razor
- @RenderBody、@RenderSection、@RenderPage、Html.RenderPartial、Html.RenderAction的作用和区别