4
Reply

What is the main difference between @Html.Partial and @Html.RenderPartial in MVC Asp.net?

    @Html.Partial is a return type and can store return value to a [email protected] is a no return type. it is a void. It directly execute where we call inside normal view.

    @Html.Partial as HTML code copied into the parent page and @Html.RenderPartial as an .ascx user control incorporated into the parent page. '@Html.Partial' returns a html encoded string that gets constructed inline with the parent. It accesses the parent's model.'@Html.RenderPartial' returns the equivalent of a .ascx user control. It gets its own copy of the page's ViewDataDictionary and changes made to the RenderPartial's ViewData do not effect the parent's ViewData.

    @Html.Partial("partialviewname")--> returns MVC HTML [email protected]("partialviewname")-->return type will be void(changes will not effect).

    http://stackoverflow.com/questions/5248183/html-partial-vs-html-renderpartial-html-action-vs-html-renderaction