Following are the available options to pass data from a Controller to View in ASP.NET MVC:
- ViewBag
- ViewData
- TempData
If we want to maintain state between a Controller and corresponding View- ViewData and ViewBag are the available options but both of these options are limited to a single server call (meaning it’s value will be null if a redirect occurs).
But if we need to maintain state from one Controller to another (redirect case), then TempDatais the other available option.
No comments:
Post a Comment