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.
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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.