Passing Data from the Action Method to the View

The most common result from a method is a ViewResult, causing a view to be rendered. All but the simplest of views require some form of data to operate on, and the MVC framework provides a range of different ways to pass data from the action method to a view. We have already encountered some of these techniques in previous chapters, but I'll recap them here for completeness.

images Note The three techniques that I describe next all pass data from an action method to a view for a single request. When the view has been rendered, the data is lost. The MVC framework supports session data if you want to pass ...

Get Applied ASP.NET 4 in Context now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.