RenderPartial和Partial方法之间的区别[复制](Difference between RenderPartial and Partial method [duplicate])

编程入门 行业动态 更新时间:2024-10-21 09:19:27
RenderPartial和Partial方法之间的区别[复制](Difference between RenderPartial and Partial method [duplicate])

可能重复: 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.

更多推荐

本文发布于:2023-07-22 09:58:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219163.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:区别   方法   Partial   RenderPartial   method

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!