可能重复: Html.Partial与Html.RenderPartial&Html.Action与Html.RenderAction
我有3个问题。
1-Whats与RenderPartial和Partial方法完全不同?
1-Whats与RenderAction和Partial RenderPartial完全不同?
2 - 什么是RendePage方法?
Possible Duplicate: Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction
I have 3 questions.
1-Whats is exactly difference between RenderPartial and Partial method?
1-Whats is exactly difference between RenderAction and Partial RenderPartial ?
2-What is the RendePage method?
最满意答案
从技术上讲, RenderPartial直接将结果直接写入响应对象的TextWriter中。 RenderPartial有点快,因此开发人员更喜欢在循环结构和相关场景中使用它。
另一方面, 部分将HTML标记作为字符串返回,缓冲内容。 它通过创建和使用单独的TextWriter来实现。
RenderAction调用指定的子操作方法,并在父视图中以内联方式呈现结果。 换句话说,允许您从视图中调用Action。
RenderPage将指定的视图(通过路径和文件名称而不是视图名称)直接呈现给响应流,如Html.RenderPartial()。
一切都取决于具体情况。
RenderPartial writes the result directly to the response, technically speaking, directly into the calling object's TextWriter. RenderPartial is a bit faster and hence developers prefer using it inside the looping constructs and related scenarios.
Partial on the other hand returns the HTML markup as string, which buffers the content. It achieves by creating and using a separate TextWriter.
RenderAction Invokes the specified child action method and renders the result inline in the parent view. In other words allows you call Action from view.
RenderPage Renders the specified view (identified by path and file name rather than by view name) directly to the response stream, like Html.RenderPartial().
Everything depends on situation.
更多推荐
发布评论