ASP. @Html. @Html. Action @Html. renderpartial @Html. Renderaction differences

Source: Internet
Author: User

The return value of the method with render is void, output inside the method, and the return value type without render is mvchtmlstring, which is a string.

Partial and RenderPartial: Loads the contents of the view file directly, action and Renderaction: re-executes the order of the Controller→model→view, then returns the resulting page back to the original view.

Partial and RenderPartial: The user control name can be supplied directly as a parameter; action and renderaction: a corresponding action is required to return partialresult within the action (that is, return Partialview ()).

For simple user controls without any logic, partial is recommended, and action is recommended for user controls that need to be set up with some model.

Another benefit of using html.action is that you can choose different user controls depending on the scene when you return Partialview.

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.