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.

public protected:
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.

public protected:
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.

public protected:
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.

public protected:
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.

public protected:
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.

public protected:
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.

public protected:
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.

public protected:
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: