Link for code samples used in the demo
http://csharp-video-tutorials.blogspo...
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
/ @aarvikitchen5572
Link for csharp, asp.net, ado.net, dotnet basics, mvc and sql server video tutorial playlists
/ kudvenkat
In this video, we will discuss the difference between Partial() and RenderPartial() html helper methods. Both of these helper methods are used for rendering partial views.
Differences:
1. The return type of "RenderPartial" is void, where as "Partial" returns "MvcHtmlString"
2. Syntax for invoking Partial() and RenderPartial() methods in Razor views
@Html.Partial("PartialViewName")
@{ Html.RenderPartial("PartialViewName"); }
3. Syntax for invoking Partial() and RenderPartial() methods in webform views
[%: Html.Partial("PartialViewName") %]
[% Html.RenderPartial("PartialViewName"); %]
The following are the 2 common interview questions related to Partial() and RenderPartial()
When would you use Partial() over RenderPartial() and vice versa?
The main difference is that "RenderPartial()" returns void and the output will be written directly to the output stream, where as the "Partial()" method returns MvcHtmlString, which can be assigned to a variable and manipulate it if required. So, when there is a need to assign the output to a variable for manipulating it, then use Partial(), else use RenderPartial().
Which one is better for performance?
From a performance perspective, rendering directly to the output stream is better. RenderPartial() does exactly the same thing and is better for performance over Partial().
Note: Make sure to replace [ with LESSTHAN and ] with GREATERTHAN symbol.
On this page of the site you can watch the video online Part 53 Difference between html.partial and html.renderpartial with a duration of hours minute second in good quality, which was uploaded by the user kudvenkat 10 July 2013, share the link with friends and acquaintances, this video has already been watched 168,848 times on youtube and it was liked by 532 viewers. Enjoy your viewing!