Export (0) Print
Expand All

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)

function View() : ViewResult

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.

Show:
© 2014 Microsoft