Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Html.RenderAction and Html.Action

Does anybody know what's the difference between Html.RenderAction and Html.Action?

like image 407
Sasha Avatar asked Jun 02 '10 05:06

Sasha


People also ask

What is the difference between HTML partial vs HTML RenderPartial and HTML action vs HTML RenderAction?

Partial injects the html string of the partial view into the main view. Html. RenderPartial writes html in the response stream. Here is what I have found:Use RenderAction when you do not have a model to send to the view and have a lot of html to bring back that doesn't need to be stored in a variable.

What is HTML action?

The action attribute specifies where to send the form-data when a form is submitted.

What is the difference between RenderPartial and render action?

RenderPartial is used to display a reusable part of within the same controller and RenderAction render an action from any controller. They both render the Html and doesn't provide a String for output.

What is RenderAction in MVC?

RenderAction(HtmlHelper, String) Invokes the specified child action method and renders the result inline in the parent view. RenderAction(HtmlHelper, String, Object) Invokes the specified child action method using the specified parameters and renders the result inline in the parent view.


2 Answers

Html.Action() – Outputs string

Html.RenderAction() – Renders directly to response stream

If the action returns a large amount of HTML, then rendering directly to the response stream provides better performance than outputting a string.

like image 123
Megawolt Avatar answered Sep 19 '22 13:09

Megawolt


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.

check out this link for a detailed explanation

like image 20
VoodooChild Avatar answered Sep 18 '22 13:09

VoodooChild