ViewContext Class¶
Constructors¶
-
Microsoft.AspNet.Mvc.ViewContext.ViewContext()
Creates an empty [Microsoft.AspNet.Mvc.ViewContext](Microsoft.AspNet.Mvc.ViewContext.yml).
public ViewContext()
-
ViewContext
(Microsoft.AspNet.Mvc.ActionContext, Microsoft.AspNet.Mvc.Rendering.IView, Microsoft.AspNet.Mvc.ViewDataDictionary, Microsoft.AspNet.Mvc.ITempDataDictionary, System.IO.TextWriter, Microsoft.AspNet.Mvc.Rendering.HtmlHelperOptions)¶ Initializes a new instance of [Microsoft.AspNet.Mvc.ViewContext](Microsoft.AspNet.Mvc.ViewContext.yml).
Arguments: - actionContext (Microsoft.AspNet.Mvc.ActionContext) – The [Microsoft.AspNet.Mvc.ActionContext]().
- view (Microsoft.AspNet.Mvc.Rendering.IView) – The [Microsoft.AspNet.Mvc.Rendering.IView](Microsoft.AspNet.Mvc.Rendering.IView.yml) being rendered.
- viewData (Microsoft.AspNet.Mvc.ViewDataDictionary) – The [Microsoft.AspNet.Mvc.ViewDataDictionary](Microsoft.AspNet.Mvc.ViewDataDictionary.yml).
- tempData (Microsoft.AspNet.Mvc.ITempDataDictionary) – The [Microsoft.AspNet.Mvc.ITempDataDictionary]().
- writer (System.IO.TextWriter) – The [System.IO.TextWriter]() to render output to.
- htmlHelperOptions (Microsoft.AspNet.Mvc.Rendering.HtmlHelperOptions) –
public ViewContext(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, TextWriter writer, HtmlHelperOptions htmlHelperOptions)
-
ViewContext
(Microsoft.AspNet.Mvc.ViewContext, Microsoft.AspNet.Mvc.Rendering.IView, Microsoft.AspNet.Mvc.ViewDataDictionary, System.IO.TextWriter) Initializes a new instance of [Microsoft.AspNet.Mvc.ViewContext](Microsoft.AspNet.Mvc.ViewContext.yml).
Arguments: - viewContext (Microsoft.AspNet.Mvc.ViewContext) – The [Microsoft.AspNet.Mvc.ViewContext](Microsoft.AspNet.Mvc.ViewContext.yml) to copy values from.
- view (Microsoft.AspNet.Mvc.Rendering.IView) – The [Microsoft.AspNet.Mvc.Rendering.IView](Microsoft.AspNet.Mvc.Rendering.IView.yml) being rendered.
- viewData (Microsoft.AspNet.Mvc.ViewDataDictionary) – The [Microsoft.AspNet.Mvc.ViewDataDictionary](Microsoft.AspNet.Mvc.ViewDataDictionary.yml).
- writer (System.IO.TextWriter) – The [System.IO.TextWriter]() to render output to.
public ViewContext(ViewContext viewContext, IView view, ViewDataDictionary viewData, TextWriter writer)
-
Properties¶
-
ClientValidationEnabled
()¶ Gets or sets a value that indicates whether client-side validation is enabled.
Return type: System.Boolean public bool ClientValidationEnabled { get; set; }
-
ExecutingFilePath
()¶ Gets or sets the path of the view file currently being rendered.
Return type: System.String public string ExecutingFilePath { get; set; }
-
FormContext
()¶ Gets or sets the [Microsoft.AspNet.Mvc.FormContext](Microsoft.AspNet.Mvc.FormContext.yml) for the form element being rendered. A default context is returned if no form is currently being rendered.
Return type: Microsoft.AspNet.Mvc.FormContext public virtual FormContext FormContext { get; set; }
-
Html5DateRenderingMode
()¶ Set this property to [Microsoft.AspNet.Mvc.Rendering.Html5DateRenderingMode.Rfc3339](Microsoft.AspNet.Mvc.Rendering.Html5DateRenderingMode.yml) to have templated helpers such as [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.Editor(System.String,System.String,System.String,System.Object)](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) and [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.EditorFor``1(System.Linq.Expressions.Expression{System.Func{`0,``0}},System.String,System.String,System.Object)](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml) render date and time values as RFC 3339 compliant strings. By default these helpers render dates and times using the current culture.
Return type: Microsoft.AspNet.Mvc.Rendering.Html5DateRenderingMode public Html5DateRenderingMode Html5DateRenderingMode { get; set; }
-
TempData
()¶ Gets or sets the [Microsoft.AspNet.Mvc.ITempDataDictionary]() instance.
Return type: Microsoft.AspNet.Mvc.ITempDataDictionary public ITempDataDictionary TempData { get; set; }
-
ValidationMessageElement
()¶ Element name used to wrap a top-level message generated by [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.ValidationMessage(System.String,System.String,System.Object,System.String)](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) and other overloads.
Return type: System.String public string ValidationMessageElement { get; set; }
-
ValidationSummaryMessageElement
()¶ Element name used to wrap a top-level message generated by [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.ValidationSummary(System.Boolean,System.String,System.Object,System.String)](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) and other overloads.
Return type: System.String public string ValidationSummaryMessageElement { get; set; }
-
View
()¶ Gets or sets the [Microsoft.AspNet.Mvc.Rendering.IView](Microsoft.AspNet.Mvc.Rendering.IView.yml) currently being rendered, if any.
Return type: Microsoft.AspNet.Mvc.Rendering.IView public IView View { get; set; }
-
ViewBag
()¶ Gets the dynamic view bag.
Return type: dynamic public ViewBag { get; }
-
ViewData
()¶ Gets or sets the [Microsoft.AspNet.Mvc.ViewDataDictionary](Microsoft.AspNet.Mvc.ViewDataDictionary.yml).
Return type: Microsoft.AspNet.Mvc.ViewDataDictionary public ViewDataDictionary ViewData { get; set; }
-
Writer
()¶ Gets or sets the [System.IO.TextWriter]() used to write the output.
Return type: System.IO.TextWriter public TextWriter Writer { get; set; }
-