MVC Razor : Difference between @Html.Partial() and Html.RenderPartial()

For more information related to this post click here

For new posts kindly visit our new site http://www.dotnet-helpers.com/

 

Difference between @Html.Partial() and Html.RenderPartial()

Html.Partial returns a string, Html.RenderPartial returns void.

We can store the output of Html.Partial in a variable/able to return from function.

In Html.RenderPartial, we can’t result void.(ie.,directly writing to the output stream so it was bit faster than html.partial())

Example :

 

Renderpartial

 

If want to refere partial view inside the shared, then it will

@{ Html.RenderPartial(“_testPartial”);}

If want to refere partial view inside the view, then it will be

@Html.Partial(“../Home/   …… 

For more information related to this post click here

For new posts kindly visit our new site http://www.dotnet-helpers.com/

Advertisements

One thought on “MVC Razor : Difference between @Html.Partial() and Html.RenderPartial()

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