Html.Partial and Html.RenderPartial Html.Action and Html.renderAction

Difference Html.Partial and Html.RenderPartial

While one can store the output of Html.Partial in a variable or return it from a method, one cannot do this with Html.RenderPartial. The result will be written to the Response stream during execution/evaluation.

Difference is Html.Partial returns an MvcHtmlString and  Html.RenderPartial outputs straight to the response.

Html.RenderPartial: directly render/write on output stream and returns void and it’s very fast in comparison to Html.Partial

You can store the output of Html.Partial in a variable, or return it from a function. You cannot do this with Html.RenderPartial. The result will be written to the Response stream during the execution

Difference Html.Action and Html.RenderAction

The same is true for Html.Action and Html.RenderAction.

The return type of Html.RenderAction is void that means it directly render the responses in View where return type of Html.Action is MvcHtmlString you can catch its render view in controller and modify it

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s