Sunday, 19 July 2015

Difference between @Html.Partial and @Html.RenderPartial

Generally we are getting confuse to use @Html.Partial and @Html.RenderPartial.

You can see below for Difference between @Html.Partial and  @Html.RenderPartial it help you to use it

1.       Return Type :  Partial Return Type is MVCHtml String; whereas RenderPartial  return type is void.

2.       Implementing  : Calling of partial Need to  call as:
Render Partail Will call as;
We enclose it like this because return type is Void;

3.       When to use and Why : If we need some output as return type will be string, that time we need to use .Partial(); So that output string we can manipulate but for render partial it will return Void.

4.       Performance: Render Partial is having good performer than partial.

5.       Syntax for it as;
@Html.Partial("Name of View")

Render Partial

@{ Html.RenderPartial("Name of View");  }

Rendering Helpers

No comments:

Post a Comment