ViewComponent Class

Definition

A base class for view components.

public ref class ViewComponent abstract
[Microsoft.AspNetCore.Mvc.ViewComponent]
public abstract class ViewComponent
[<Microsoft.AspNetCore.Mvc.ViewComponent>]
type ViewComponent = class
Public MustInherit Class ViewComponent
Inheritance
ViewComponent
Attributes

Constructors

ViewComponent()

Properties

HttpContext

Gets the HttpContext.

ModelState

Gets the ModelStateDictionary.

Request

Gets the HttpRequest.

RouteData

Gets the RouteData for the current request.

TempData

Gets the ITempDataDictionary.

Url

Gets or sets the IUrlHelper.

User

Gets the IPrincipal for the current user.

UserClaimsPrincipal

Gets the ClaimsPrincipal for the current user.

ViewBag

Gets the view bag.

ViewComponentContext

Gets or sets the ViewComponentContext.

ViewContext

Gets the ViewContext.

ViewData

Gets the ViewDataDictionary.

ViewEngine

Gets or sets the ICompositeViewEngine.

Methods

Content(String)

Returns a result which will render HTML encoded text.

View()

Returns a result which will render the partial view with name "Default".

View(String)

Returns a result which will render the partial view with name viewName.

View<TModel>(String, TModel)

Returns a result which will render the partial view with name viewName.

View<TModel>(TModel)

Returns a result which will render the partial view with name "Default".

Applies to