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, IComponentRenderer
Type Parameters
NameDescription
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
TypeNameDescription
System.Stringlocator

The string to use when locating the View Component.

System.StringviewName

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
TypeNameDescription
ISitecoreRenderingContextrenderingContext

The current ISitecoreRenderingContext.

Microsoft.AspNetCore.Mvc.Rendering.ViewContextviewContext

The current Microsoft.AspNetCore.Mvc.Rendering.ViewContext.

Returns
TypeDescription
System.Threading.Tasks.Task<Microsoft.AspNetCore.Html.IHtmlContent>

The HTML content to render.

Implements

Do you have some feedback for us?

If you have suggestions for improving this article,