Controller.View Method

 

Creates a ViewResult object that renders a view to the response.

Namespace:   System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

NameDescription
System_CAPS_protmethodView()

Creates a ViewResult object that renders a view to the response.

System_CAPS_protmethodView(IView)

Creates a ViewResult object that renders the specified IView object.

System_CAPS_protmethodView(IView, Object)

Creates a ViewResult object that renders the specified IView object.

System_CAPS_protmethodView(Object)

Creates a ViewResult object by using the model that renders a view to the response.

System_CAPS_protmethodView(String)

Creates a ViewResult object by using the view name that renders a view.

System_CAPS_protmethodView(String, Object)

Creates a ViewResult object that renders the specified IView object.

System_CAPS_protmethodView(String, String)

Creates a ViewResult object using the view name and master-page name that renders a view to the response.

System_CAPS_protmethodView(String, String, Object)

Creates a ViewResult object using the view name, master-page name, and model that renders a view.

Return to top

Controller.View Method ()

Creates a ViewResult object that renders a view to the response.

protected internal ViewResult View()

Return Value

Type: System.Web.Mvc.ViewResult

The View result that renders a view to the response.

This method overload of the View class returns a ViewResult object that has an empty ViewName property. If you are writing unit tests for controller actions, take into account the empty ViewName property for unit tests that do not take a string view name.

At run time, if the ViewName property is empty, the current action name is used in place of the ViewName property.

Return to top

Controller.View Method (IView)

Creates a ViewResult object that renders the specified IView object.

protected internal ViewResult View(
	IView view
)

Parameters

view
Type: System.Web.Mvc.IView

The view that is rendered to the response.

Return Value

Type: System.Web.Mvc.ViewResult

The view result.

The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed.

Return to top

Controller.View Method (IView, Object)

Creates a ViewResult object that renders the specified IView object.

protected internal virtual ViewResult View(
	IView view,
	object model
)

Parameters

view
Type: System.Web.Mvc.IView

The view that is rendered to the response.

model
Type: System.Object

The model that is rendered by the view.

Return Value

Type: System.Web.Mvc.ViewResult

The view result.

The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed.

Return to top

Controller.View Method (Object)

Creates a ViewResult object by using the model that renders a view to the response.

protected internal ViewResult View(
	object model
)

Parameters

model
Type: System.Object

The model that is rendered by the view.

Return Value

Type: System.Web.Mvc.ViewResult

The view result.

This overload of the View method returns a ViewResult object that has an empty ViewName property. If you are writing unit tests for controller actions, take into account the empty ViewNameproperty for unit tests that do not take a string view name.

Return to top

Controller.View Method (String)

Creates a ViewResult object by using the view name that renders a view.

protected internal ViewResult View(
	string viewName
)

Parameters

viewName
Type: System.String

The name of the view that is rendered to the response.

Return Value

Type: System.Web.Mvc.ViewResult

The view result.

The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed.

Return to top

Controller.View Method (String, Object)

Creates a ViewResult object that renders the specified IView object.

protected internal ViewResult View(
	string viewName,
	object model
)

Parameters

viewName
Type: System.String

The view that is rendered to the response.

model
Type: System.Object

The model that is rendered by the view.

Return Value

Type: System.Web.Mvc.ViewResult

The view result.

The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed.

Return to top

Controller.View Method (String, String)

Creates a ViewResult object using the view name and master-page name that renders a view to the response.

protected internal ViewResult View(
	string viewName,
	string masterName
)

Parameters

viewName
Type: System.String

The name of the view that is rendered to the response.

masterName
Type: System.String

The name of the master page or template to use when the view is rendered.

Return Value

Type: System.Web.Mvc.ViewResult

The view result.

The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed.

Return to top

Controller.View Method (String, String, Object)

Creates a ViewResult object using the view name, master-page name, and model that renders a view.

protected internal virtual ViewResult View(
	string viewName,
	string masterName,
	object model
)

Parameters

viewName
Type: System.String

The name of the view that is rendered to the response.

masterName
Type: System.String

The name of the master page or template to use when the view is rendered.

model
Type: System.Object

The model that is rendered by the view.

Return Value

Type: System.Web.Mvc.ViewResult

The view result.

The result object that is prepared by this method is written to the response by the ASP.NET MVC framework when the object is executed.

Return to top
Show: