ViewContext Class

Definition

Context for view execution.

C#
public class ViewContext : Microsoft.AspNetCore.Mvc.ActionContext
Inheritance
ViewContext

Constructors

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

Applies to

Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0