Class ModelBoundViewComponentComponentRenderer<TModel>
Version: 21.x
An IComponentRenderer that will render View Components that are bound to a specified Model type.
Inheritance
System.Object
ModelBoundViewComponentComponentRenderer<TModel>
Implements
Namespace: Sitecore.AspNet.RenderingEngine.Rendering
Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
RequestResponse
public class ModelBoundViewComponentComponentRenderer<TModel> : Object, IComponentRendererType Parameters
| Name | Description |
|---|---|
| TModel |
The model type to bind to the View Component. |
Constructors
ModelBoundViewComponentComponentRenderer(String, String)
Initializes a new instance of the ModelBoundViewComponentComponentRenderer<TModel> class.
Declaration
RequestResponse
public ModelBoundViewComponentComponentRenderer(string locator, string viewName)Parameters
| Type | Name | Description |
|---|---|---|
| System.String | locator |
The string to use when locating the View Component. |
| System.String | viewName |
The name of the view to use when rendering. |
Methods
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. |