18 April 2014

ActionResult Return Type -- Basics MVC( Model View Controller)

There are different types of results that are available to you in ASP.NET MVC 3. When creating new controllers, they will come with one or more actions by default.

 The Empty controller includes an Index action with a return value of type 

ActionResult class is the base class for all action results. There are different ActionResult types are there, briefly explained below.
 
ActionResult
Helper Method
Description
ViewResult
View
Renders a view as a web page
PartialViewResult
PartialView
Section of a view, that can be rendered inside another view
RedirectResult
Redirect
Redirect to another action method
RedirectToRouteResult
RedirectToRoute
Redirect to another action method
ContentResult
Content
Returns a user-defined content type
JsonResult
Json
Retuns a serialized JSON object
JavaScriptResult
JavaScript
Returns a script that can be executed on the client
FileResult
File
Returns a binary output to write to the response
EmptyResult
(None)
returns a null result

No comments:

Post a Comment