ASP.NET MVC pass information from controller to view WITHOUT ViewData, ViewModel, or Session
Posted
by josh
on Stack Overflow
See other posts from Stack Overflow
or by josh
Published on 2010-04-05T15:27:46Z
Indexed on
2010/04/05
15:33 UTC
Read the original article
Hit count: 270
I have a unique scenario where I want a base controller to grab some data and store it in a list. The list should be accessible from my views just as ViewData is. I will be using this list on every page and would like a cleaner solution than just shoving it in the ViewDataDictionary.
After attempting to come up with a solution, I thought I would create a custom ViewPage with a property to hold my list. My custom ViewPage would inherit from System.Web.MVC.ViewPage. However, I do not know where MVC passes the viewdata from the controller off to the view. More importantly, how do I get it to pass my list down to the view?
Thanks for the help.
© Stack Overflow or respective owner