Este artículo se tradujo de forma manual. Mueva el puntero sobre las frases del artículo para ver el texto original. |
Traducción
Original
|
ViewResult (Clase)
Representa una clase que se utiliza para representar una vista utilizando una instancia de IView devuelta por un objeto IViewEngine.
Espacio de nombres: System.Web.Mvc
Ensamblado: System.Web.Mvc (en System.Web.Mvc.dll)
El tipo ViewResult expone los siguientes miembros.
| Nombre | Descripción | |
|---|---|---|
|
MasterName | Obtiene el nombre de la vista maestra (tal como una plantilla o página maestra) que se va a utilizar cuando se presente la vista. |
|
Model | Obtiene el modelo de datos de la vista. (Se hereda de ViewResultBase). |
|
TempData | Obtiene o establece el objeto TempDataDictionary para este resultado. (Se hereda de ViewResultBase). |
|
View | Obtiene o establece el objeto IView que se representa para la respuesta. (Se hereda de ViewResultBase). |
|
ViewBag | Obtiene el contenedor de la vista. (Se hereda de ViewResultBase). |
|
ViewData | Obtiene o establece el objeto ViewDataDictionaryde datos de vista para este resultado. (Se hereda de ViewResultBase). |
|
ViewEngineCollection | Obtiene o establece la colección de motores de vista asociados a este resultado. (Se hereda de ViewResultBase). |
|
ViewName | Obtiene o establece el nombre de la vista que se va a representar. (Se hereda de ViewResultBase). |
| Nombre | Descripción | |
|---|---|---|
|
Equals | (Se hereda de Object). |
|
ExecuteResult | Cuando lo llama el invocador de acción, representa la vista para la respuesta. (Se hereda de ViewResultBase). |
|
Finalize | (Se hereda de Object). |
|
FindView | Busca en los motores de vista registrados y devuelve el objeto que se utiliza para representar la vista. (Invalida a ViewResultBase.FindView(ControllerContext)). |
|
GetHashCode | (Se hereda de Object). |
|
GetType | (Se hereda de Object). |
|
MemberwiseClone | (Se hereda de Object). |
|
ToString | (Se hereda de Object). |
An action result represents a command that ASP.NET performs on behalf of an action method. The ViewResult class implements the abstract ViewResultBase class and is used to render a view. This class contains methods for finding the view to render and for executing the result. This class also contains properties that identify the view to render, the name of the view, the name of the master view, view data, temporary data, and a collection for view engines for the application.
If you want an action method to result in a rendered view, the action method should return a call to the controller's View helper method. The View helper method passes a ViewResult object to the ASP.NET MVC framework, which calls the object's ExecuteResult method.
The following example shows an action method that uses the controller's View helper method to pass a ViewResult object to the framework, which then executes the result and renders the view.