griegs
griegs

Reputation: 22760

Switch MasterPageFile at runtime

During runtime, is there a way to specify which MasterPageFile a view should use?

Basically when the view is rendered I need to tell it which Master Page File to use which may be obtained from a database or something.

Upvotes: 0

Views: 727

Answers (1)

griegs
griegs

Reputation: 22760

It's OK I found it. There is an overide in the View() method that takes a master page as an argument.

return View("Index","~/Views/Shared/Site.Master");

Upvotes: 2

Related Questions