Class SitecoreComponentViewComponent

Version: 21.x

Default view with model binding to render components.

Inheritance
System.Object
SitecoreComponentViewComponent
Namespace: Sitecore.AspNet.RenderingEngine.ViewComponents
Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
RequestResponse
public class SitecoreComponentViewComponent : BindingViewComponent

Constructors

SitecoreComponentViewComponent(IViewModelBinder)

Initializes a new instance of the SitecoreComponentViewComponent class.

Declaration
RequestResponse
public SitecoreComponentViewComponent(IViewModelBinder binder)
Parameters
TypeNameDescription
IViewModelBinderbinder

The IViewModelBinder to use when binding the model to the view component.

Methods

InvokeAsync(Type, String)

Executes the view component.

Declaration
RequestResponse
public Task<IViewComponentResult> InvokeAsync(Type modelType, string viewName)
Parameters
TypeNameDescription
System.TypemodelType

The type of the model to use when generating the view component output.

System.StringviewName

The name of the view to use when generating the view component output.

Returns
TypeDescription
System.Threading.Tasks.Task<Microsoft.AspNetCore.Mvc.IViewComponentResult>

A System.Threading.Tasks.Task<> representing the result of the asynchronous operation.

Do you have some feedback for us?

If you have suggestions for improving this article,