博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
@Html.RenderAction/Partial VS @Html.Action/Partial & @Html.Partial VS @Html.Action
阅读量:7164 次
发布时间:2019-06-29

本文共 1067 字,大约阅读时间需要 3 分钟。

Refer to

Html.RenderAction VS Html.Action

The difference between the two is that Html.RenderAction will render the result directly to the Response (which is more efficient if the action returns a large amount of HTML) whereas Html.Action returns a string with the result.

On the other side, I do not entirely through away @Html.Partial and @Html.Action. These methods are good for some cases when you need to put sub-template content into a variable or do something with it (which was a pain in older MVC versions). And they may be life-saving in certain scenarios like caching.

 

Html.RenderAction VS Html.RenderPartial

There is a big difference between RenderAction and RenderPartial. RenderPartial will render a View on the same controller (or a shared one), while RenderAction will actually perform an entire cycle of MVC, that is: it will instantiate the controller (any controller you mention, not just the current one), it will execute the action, and it will then return and render the result.

转载于:https://www.cnblogs.com/webglcn/archive/2012/09/28/2706789.html

你可能感兴趣的文章