Class BindingViewComponent
Version: 21.x
Provides delayed binding for a Microsoft.AspNetCore.Mvc.ViewComponent.
Inheritance
System.Object
BindingViewComponent
SitecoreComponentViewComponent
Namespace: Sitecore.AspNet.RenderingEngine.Mvc
Assembly: Sitecore.AspNet.RenderingEngine.dll
Syntax
Constructors
BindingViewComponent(IViewModelBinder)
Initializes a new instance of the BindingViewComponent class.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| IViewModelBinder | binder | The IViewModelBinder to enable binding. |
Properties
Binder
Gets the instance of IViewModelBinder used for binding.
Declaration
Property Value
| Type | Description |
|---|---|
| IViewModelBinder |
Methods
BindView(Type, String)
Returns the specified view bound to the given model type.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | modelType | The model type to be used for binding. |
| System.String | viewName | The view to be returned. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task < Microsoft.AspNetCore.Mvc.IViewComponentResult > | The Microsoft.AspNetCore.Mvc.IViewComponentResult. |
BindView()
Returns the default view using a bound model of TModel.
Declaration
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task < Microsoft.AspNetCore.Mvc.IViewComponentResult > | The Microsoft.AspNetCore.Mvc.IViewComponentResult. |
Type Parameters
| Name | Description |
|---|---|
| TModel | The model to be bound. |
BindView(TModel)
Returns the default view bound to the given model.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| TModel | model | An instance of TModel to be bound. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task < Microsoft.AspNetCore.Mvc.IViewComponentResult > | The Microsoft.AspNetCore.Mvc.IViewComponentResult. |
Type Parameters
| Name | Description |
|---|---|
| TModel | The model to be bound. |
BindView(String)
Returns the specified view using a bound model of TModel.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | viewName | The view to be returned. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task < Microsoft.AspNetCore.Mvc.IViewComponentResult > | The Microsoft.AspNetCore.Mvc.IViewComponentResult. |
Type Parameters
| Name | Description |
|---|---|
| TModel | The model to be bound. |
BindView(String, TModel)
Returns the specified view bound to the given model.
Declaration
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | viewName | The view to be returned. |
| TModel | model | An instance of TModel to be bound. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task < Microsoft.AspNetCore.Mvc.IViewComponentResult > | The Microsoft.AspNetCore.Mvc.IViewComponentResult. |
Type Parameters
| Name | Description |
|---|---|
| TModel | The model to be bound. |
If you have suggestions for improving this article, let us know!