Thursday, December 15, 2016

Part 19 - Difference between Html.Partial and Html.RenderPartial in asp.net MVC



#Html.Partial 

a)@Html.Partial(“PartialViewName”, new { id = 1} );
b)Renders the partial view as an HTML-encoded string.
c)This method result can be stored in a variable, since it returns string type value

d)Simple to use and no need to create any action.

# Html.RenderPartial 

a)@{ Html.RenderPartial(“PartialViewName”, object);}
b)This method result will be directly written to the HTTP response stream means it uses the same TextWriter object as used in the current webpage/template
c)This method returns void
d)This method is faster than Partial method since its result is directly written to the response stream which makes it fast



All Code Factory