Class PartialViewComponentRenderer
Version: 21.x
An IComponentRenderer that will render Partial Views.
Inheritance
System.Object
PartialViewComponentRenderer
Implements
Namespace: Sitecore.AspNet.RenderingEngine.Rendering
Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
RequestResponse
public class PartialViewComponentRenderer : Object, IComponentRendererConstructors
PartialViewComponentRenderer(String)
Initializes a new instance of the PartialViewComponentRenderer class.
Declaration
RequestResponse
public PartialViewComponentRenderer(string locator)Parameters
| Type | Name | Description |
|---|---|---|
| System.String | locator |
The string to use when locating the Partial View. |
Methods
Describe(Predicate<String>, String)
Creates an instance of a ComponentRendererDescriptor for the PartialViewComponentRenderer class.
Declaration
RequestResponse
public static ComponentRendererDescriptor Describe(Predicate<string> match, string locator)Parameters
| Type | Name | Description |
|---|---|---|
| System.Predicate<System.String> | match |
A predicate to use when attempting to match a layout component. |
| System.String | locator |
The string to use when locating the Partial View. |
Returns
| Type | Description |
|---|---|
| ComponentRendererDescriptor |
An instance of ComponentRendererDescriptor that describes the PartialViewComponentRenderer. |
Render(ISitecoreRenderingContext, ViewContext)
Generates the output HTML.
Declaration
RequestResponse
public Task<IHtmlContent> Render(ISitecoreRenderingContext renderingContext, ViewContext viewContext)Parameters
| Type | Name | Description |
|---|---|---|
| ISitecoreRenderingContext | renderingContext |
The current ISitecoreRenderingContext. |
| Microsoft.AspNetCore.Mvc.Rendering.ViewContext | viewContext |
The current Microsoft.AspNetCore.Mvc.Rendering.ViewContext. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.IHtmlContent> |
The HTML content to render. |