Quantcast
Channel: MVC – AuthorCode
Viewing all articles
Browse latest Browse all 10

[Table] Difference between Html.RenderPartial and Html.Partial in MVC Razor

$
0
0

There are different ways to render a partial view in MVC Razor such as using the Html.RenderPartial, Html.Partial, Html.Renderaction and Html.action etc. In the following table you can see the difference between Html.RenderPartial and Html.Partial.

Html.RenderPartial Html.Partial
Renderpartial writes the partial view response directly into http response stream. The return of partial method is html encoded string.
The return type of Html.RenderPartial is void. The result of this method can we stored in a variable because it return string type values
No action method required to call partial view by renderpartial. No need to create action method.
Renderpartail view method display the data is already in corresponding view. Partial view method display the data is already in corresponding view.
Response of this method faster because it write response directly in to response stream Its response slower than render partial
@{Html.RenderPartial(“_partialviewname”);} @Html.Partial(“_partialviewname “)

Viewing all articles
Browse latest Browse all 10

Trending Articles