Html.renderpartial ("") differs from Html.partial ("")

Source: Internet
Author: User

This HtmlHelper extension method partial, and the HtmlHelper comes with the renderpartial function to be close,

Both can output a partial view, with the following differences:

< A;. The partial has a return value (mvchtmlstring); renderpartial has no return value (Void).

< two > But partial is to generate a string directly from the view content and return it, and the RenderPartial method is output directly to the current HttpContext. So the way they're used in the view is different,

The partial output to the TEMP variable StringWriter; renderpartial output to HtmlHelper.ViewContext.Writer (that is, direct output to response).

< three > syntax is not the same in Razor view:


1 @Html. Partial ("Partialviewname")

2 @{html.renderpartial ("Partialviewname"

Html.renderpartial ("") differs from Html.partial ("")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.