---
title: "Class BindingViewComponent"
slug: "sitecore.aspnet.renderingengine.mvc.bindingviewcomponent"
abstract: ""
---
# Class BindingViewComponent

Provides delayed binding for a Microsoft.AspNetCore.Mvc.ViewComponent.

## Inheritance

System.Object

BindingViewComponent

[SitecoreComponentViewComponent](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.aspnet.renderingengine.viewcomponents.sitecorecomponentviewcomponent.html)

### **Namespace**: Sitecore.AspNet.RenderingEngine.Mvc

#### **Assembly**: Sitecore.AspNet.RenderingEngine.dll

##### Syntax

```csharp
public abstract class BindingViewComponent : ViewComponent

```

### Constructors

#### BindingViewComponent(IViewModelBinder)

Initializes a new instance of the [BindingViewComponent](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.aspnet.renderingengine.mvc.bindingviewcomponent.html) class.

##### Declaration

```csharp
protected BindingViewComponent(IViewModelBinder binder)

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| IViewModelBinder | binder | The [IViewModelBinder](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.aspnet.renderingengine.binding.iviewmodelbinder.html) to enable binding. |

### Properties

#### Binder

Gets the instance of [IViewModelBinder](https://doc.sitecore.com/xp/en/developers/hd/21/sitecore-asp-dot-net-rendering-sdk/sitecore.aspnet.renderingengine.binding.iviewmodelbinder.html) used for binding.

##### Declaration

```csharp
protected IViewModelBinder Binder { get; }

```

##### Property Value

| Type | Description |
| --- | --- |
| IViewModelBinder |  |

### Methods

#### BindView(Type, String)

Returns the specified view bound to the given model type.

##### Declaration

```csharp
public virtual Task<IViewComponentResult> BindView(Type modelType, string viewName)

```

##### 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<br><br><<br><br>Microsoft.AspNetCore.Mvc.IViewComponentResult<br><br>> | The Microsoft.AspNetCore.Mvc.IViewComponentResult. |

#### BindView<TModel>()

Returns the default view using a bound model of `TModel`.

##### Declaration

```

public virtual Task<IViewComponentResult> BindView<TModel>()
    where TModel : class, new()

```

##### Returns

| Type | Description |
| --- | --- |
| System.Threading.Tasks.Task<br><br><<br><br>Microsoft.AspNetCore.Mvc.IViewComponentResult<br><br>> | The Microsoft.AspNetCore.Mvc.IViewComponentResult. |

##### Type Parameters

| Name | Description |
| --- | --- |
| TModel | The model to be bound. |

#### BindView<TModel>(TModel)

Returns the default view bound to the given model.

##### Declaration

```

public virtual Task<IViewComponentResult> BindView<TModel>(TModel model)
    where TModel : class

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| TModel | model | An instance of `TModel` to be bound. |

##### Returns

| Type | Description |
| --- | --- |
| System.Threading.Tasks.Task<br><br><<br><br>Microsoft.AspNetCore.Mvc.IViewComponentResult<br><br>> | The Microsoft.AspNetCore.Mvc.IViewComponentResult. |

##### Type Parameters

| Name | Description |
| --- | --- |
| TModel | The model to be bound. |

#### BindView<TModel>(String)

Returns the specified view using a bound model of `TModel`.

##### Declaration

```

public virtual Task<IViewComponentResult> BindView<TModel>(string viewName)
    where TModel : class, new()

```

##### Parameters

| Type | Name | Description |
| --- | --- | --- |
| System.String | viewName | The view to be returned. |

##### Returns

| Type | Description |
| --- | --- |
| System.Threading.Tasks.Task<br><br><<br><br>Microsoft.AspNetCore.Mvc.IViewComponentResult<br><br>> | The Microsoft.AspNetCore.Mvc.IViewComponentResult. |

##### Type Parameters

| Name | Description |
| --- | --- |
| TModel | The model to be bound. |

#### BindView<TModel>(String, TModel)

Returns the specified view bound to the given model.

##### Declaration

```

public virtual Task<IViewComponentResult> BindView<TModel>(string viewName, TModel model)
    where TModel : class

```

##### 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<br><br><<br><br>Microsoft.AspNetCore.Mvc.IViewComponentResult<br><br>> | The Microsoft.AspNetCore.Mvc.IViewComponentResult. |

##### Type Parameters

| Name | Description |
| --- | --- |
| TModel | The model to be bound. |
