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.