A Partial View in ASP.NET MVC is a reusable view component that represents a portion of a web page. It is typically used to render small, self-contained parts of the UI, such as headers, footers, menus, or widgets, and can be shared across multiple views to promote reusability and modularity.
1. Using Html.Partial
@Html.Partial("_PartialViewName", model)
2. Using Html.RenderPartial
@Html.RenderPartial("_PartialViewName", model)
3. Using Html.Partial or RenderPartial
@Html.Partial("_ProductDetails", productModel)
Feature | Partial View | View |
---|---|---|
Purpose | Represents part of a view. | Represents a complete web page. |
Layout Rendering | Does not use a layout by default. | Uses a layout by default (e.g., _Layout ). |
Reusability | Can be reused across multiple views. | Typically used for a specific action. |
Controller Action | Cannot directly call controller actions. | Directly tied to a controller action. |