There are some cases where you might like to step aside and write directly to the HTTP Response stream rather than having a partial view render the results (partials/views use MvcHtmlString/StringWriter)
Use Html.RenderPartial for streaming images or other elements that are media-centric or where faster download times are highly important.
有什么开销
MvcHtmlString/StringWriter
介绍?使用 Html.RenderPartial
有什么缺点吗?一直以来,如果开销较少?我在 MSDN 上找不到答案:
http://msdn.microsoft.com/en-us/library/ee402902.aspx
http://msdn.microsoft.com/en-us/library/system.web.mvc.html.renderpartialextensions.renderpartial.aspx
最佳答案
Html.RenderPartial 比 Html.Partial 快,因为 RenderPartial 可以快速响应输出。
这里有一些引用:-
http://devlicio.us/blogs/derik_whittaker/archive/2008/11/24/renderpartial-vs-renderaction.aspx
What is the difference (if any) between Html.Partial(view, model) and Html.RenderPartial(view,model) in MVC2?
关于asp.net-mvc-3 - MVC 3 Html.RenderPartial 与 Html.Partial,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9623786/