Class ModelBoundViewComponentComponentRenderer

Version: 21.x

An IComponentRenderer that will render View Components that are bound to a specified Model type.

Inheritance

System.Object

ModelBoundViewComponentComponentRenderer

Implements

IComponentRenderer

Namespace: Sitecore.AspNet.RenderingEngine.Rendering

Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
public class ModelBoundViewComponentComponentRenderer<TModel> : Object, IComponentRenderer
Type Parameters
NameDescription
TModelThe model type to bind to the View Component.

Constructors

ModelBoundViewComponentComponentRenderer(String, String)

Initializes a new instance of the ModelBoundViewComponentComponentRenderer class.

Declaration
public ModelBoundViewComponentComponentRenderer(string locator, string viewName)
Parameters
TypeNameDescription
System.StringlocatorThe string to use when locating the View Component.
System.StringviewNameThe name of the view to use when rendering.

Methods

Render(ISitecoreRenderingContext, ViewContext)

Generates the output HTML.

Declaration
public Task<IHtmlContent> Render(ISitecoreRenderingContext renderingContext, ViewContext viewContext)
Parameters
TypeNameDescription
ISitecoreRenderingContextrenderingContextThe current ISitecoreRenderingContext.
Microsoft.AspNetCore.Mvc.Rendering.ViewContextviewContextThe current Microsoft.AspNetCore.Mvc.Rendering.ViewContext.
Returns
TypeDescription
System.Threading.Tasks.Task

<

Microsoft.AspNetCore.Html.IHtmlContent

>
The HTML content to render.

Implements

IComponentRenderer

If you have suggestions for improving this article, let us know!