I have an asp.net masterpage, and All my controllers inherit from a controller base. All my view models inherit from ViewBase. How can I have a base set of data in the master page that is populated from the base controller into the viewbase, then into the masterpage?
I have an asp.net masterpage, and All my controllers inherit from a controller base.
Share
What I have done in the past is used ViewData to populate my master page.
Inside your master page you can put:
then
baseModel.xxfor whatever properties you need throughout your masterpage.In my ControllerBase, I then override OnActionExecuting and popluate the viewData with an instance of my baseViewModel.