Methods and differences for loading partial views in ASP.

Source: Internet
Author: User

There are several ways to load a partial view in a view, including the partial (), Action (), renderpartial (), Renderaction (), Renderpage () methods. The differences between these methods are described below.

1. Partial and RenderPartial methods

Partial can output content directly, convert HTML content into string characters (mvchtmlstring) internally, and then cache it and output it to the page at once. Low efficiency

Usually use renderpartial instead of

2. RenderPartial and Renderaction methods

RenderPartial does not need to create the Controller's action, and renderaction needs to create the action to load in the controller.

If the partial view is just some simple HTML code, use the RenderPartial

3. Renderaction and Action methods

Action is also the direct output, and partial as there is a conversion process, as renderaction direct output efficiency is high

4. Renderpage and RenderPartial methods

Using Renderpage to render partial views cannot use the original view's model and viewdate, only pass through parameters, whereas renderpartial can use the model and ViewData of the original view.

  

Methods and differences for loading partial views in ASP.

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.