Table of Contents

Class ViewUserControl

Namespace
System.Web.Mvc
Assembly
System.Web.Mvc.dll

Represents the information that is needed to build a user control.

public class ViewUserControl : UserControl, IViewDataContainer
Inheritance
ViewUserControl
Implements
Derived

Constructors

ViewUserControl()

Initializes a new instance of the ViewUserControl class.

public ViewUserControl()

Properties

Ajax

Gets the AJAX script for the view.

public AjaxHelper<object> Ajax { get; }

Property Value

AjaxHelper<object>

The AJAX script for the view.

Html

Gets the HTML for the view.

public HtmlHelper<object> Html { get; }

Property Value

HtmlHelper<object>

The HTML for the view.

Model

Gets the model.

public object Model { get; }

Property Value

object

The model.

TempData

Gets the temporary-data dictionary.

public TempDataDictionary TempData { get; }

Property Value

TempDataDictionary

The temporary-data dictionary.

Url

Gets the URL for the view.

public UrlHelper Url { get; }

Property Value

UrlHelper

The URL for the view.

ViewBag

Gets the view bag.

public dynamic ViewBag { get; }

Property Value

dynamic

The view bag.

ViewContext

Gets or sets the view context.

[Browsable(false)]
public ViewContext ViewContext { get; set; }

Property Value

ViewContext

The view context.

ViewData

Gets or sets the view-data dictionary.

[Browsable(false)]
public ViewDataDictionary ViewData { get; set; }

Property Value

ViewDataDictionary

The view-data dictionary.

ViewDataKey

Gets or sets the view-data key.

public string ViewDataKey { get; set; }

Property Value

string

The view-data key.

Writer

Gets the writer that is used to render the view to the response.

public HtmlTextWriter Writer { get; }

Property Value

HtmlTextWriter

The writer that is used to render the view to the response.

Methods

EnsureViewData()

Ensures that view data is added to the ViewDataDictionary object of the user control if the view data exists.

protected void EnsureViewData()

RenderView(ViewContext)

Renders the view by using the specified view context.

public virtual void RenderView(ViewContext viewContext)

Parameters

viewContext ViewContext

The view context.

SetTextWriter(TextWriter)

Sets the text writer that is used to render the view to the response.

[Obsolete("The TextWriter is now provided by the ViewContext object passed to the RenderView method.", true)]
public void SetTextWriter(TextWriter textWriter)

Parameters

textWriter TextWriter

The writer that is used to render the view to the response.

SetViewData(ViewDataDictionary)

Sets the view-data dictionary by using the specified view data.

protected virtual void SetViewData(ViewDataDictionary viewData)

Parameters

viewData ViewDataDictionary

The view data.