views:

101

answers:

2

I know how to make nested master pages in webforms but is it also possible in MVC2? I know how to do it with markup only though.

I would like to set it from code depending on a criteria. Is it possible with some code in the controller to define the nested master page and master page?

+1  A: 

" Is it possible with some code in the controller to define the nested master page and master page?"

Nope. The default view engine only lets you define one level of MasterPages.

See: http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.view.aspx

jfar
A: 

Well there is no way of doing that in the controller, afaik. However what is stopping you from passing in a ViewState variable and quering that in your view to determine what your masterpage should be ?

Something that might help you: templated partial view

Danthar