ViewContext Class

Definition

Context for view execution.

public ref class ViewContext : Microsoft::AspNetCore::Mvc::ActionContext
public class ViewContext : Microsoft.AspNetCore.Mvc.ActionContext
type ViewContext = class
    inherit ActionContext
Public Class ViewContext
Inherits ActionContext
Inheritance
ViewContext

Constructors

ViewContext()

Creates an empty ViewContext.

ViewContext(ActionContext, IView, ViewDataDictionary, ITempDataDictionary, TextWriter, HtmlHelperOptions)

Initializes a new instance of ViewContext.

ViewContext(ViewContext, IView, ViewDataDictionary, TextWriter)

Initializes a new instance of ViewContext.

Properties

ActionDescriptor

Gets or sets the ActionDescriptor for the selected action.

(Inherited from ActionContext)
CheckBoxHiddenInputRenderMode

Gets or sets the way hidden inputs are rendered for checkbox tag helpers and html helpers.

ClientValidationEnabled

Gets or sets a value that indicates whether client-side validation is enabled.

ExecutingFilePath

Gets or sets the path of the view file currently being rendered.

FormContext

Gets or sets the FormContext for the form element being rendered. A default context is returned if no form is currently being rendered.

Html5DateRenderingMode

Set this property to CurrentCulture to have templated helpers such as Editor(String, String, String, Object) and EditorFor<TResult>(Expression<Func<TModel,TResult>>, String, String, Object) render date and time values using the current culture. By default, these helpers render dates and times as RFC 3339 compliant strings.

HttpContext

Gets or sets the HttpContext for the current request.

(Inherited from ActionContext)
ModelState

Gets the ModelStateDictionary.

(Inherited from ActionContext)
RouteData

Gets or sets the RouteData for the current request.

(Inherited from ActionContext)
TempData

Gets or sets the ITempDataDictionary instance.

ValidationMessageElement

Element name used to wrap a top-level message generated by ValidationMessage(String, String, Object, String) and other overloads.

ValidationSummaryMessageElement

Element name used to wrap a top-level message generated by ValidationSummary(Boolean, String, Object, String) and other overloads.

View

Gets or sets the IView currently being rendered, if any.

ViewBag

Gets the dynamic view bag.

ViewData

Gets or sets the ViewDataDictionary.

Writer

Gets or sets the TextWriter used to write the output.

Methods

GetFormContextForClientValidation()

Gets the FormContext if ClientValidationEnabled is enabled.

Applies to