This article states
There are some cases where you might like to step aside and write directly to the HTTP Response stream rather than having a partial view render the results (partials/views use MvcHtmlString/StringWriter)
Use Html.RenderPartial for streaming images or other elements that are media-centric or where faster download times are highly important.
What overhead does MvcHtmlString/StringWriter
introduce? Are there downsides to using Html.RenderPartial
all of the time, if there is less overhead?
I could not find answers on MSDN:
http://msdn.microsoft.com/en-us/library/ee402902.aspx
http://msdn.microsoft.com/en-us/library/system.web.mvc.html.renderpartialextensions.renderpartial.aspx
The primary difference between the two methods is that Partial generates the HTML from the View and returns it to the View to be incorporated into the page. RenderPartial, on the other hand, doesn't return anything and, instead, adds its HTML directly to the Response object's output.
Partial when you are rendering static content. Action Partial : Use Html. Action when handling dynamic Content/data.
Use RenderPartial when you have a model to send to the view and there will be a lot of html that doesn't need to be stored in a variable. Use Partial when you have a model to send to the view and there will be a little bit of text that needs to be stored in a variable. RenderAction and RenderPartial are faster.
RenderPartial(HtmlHelper, String) Renders the specified partial view by using the specified HTML helper. RenderPartial(HtmlHelper, String, Object) Renders the specified partial view, passing it a copy of the current ViewDataDictionary object, but with the Model property set to the specified model.
Html.RenderPartial is faster then Html.Partial because of RenderPartial give quick response to Output.
here are some reference:-
http://devlicio.us/blogs/derik_whittaker/archive/2008/11/24/renderpartial-vs-renderaction.aspx
What is the difference (if any) between Html.Partial(view, model) and Html.RenderPartial(view,model) in MVC2?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With