Developer forum

Forum » Templates » Dynamic master page

Dynamic master page

Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Is it possible to dynamically set which master page to use?

I have tried this, but it does not work out. I guess it is because of how you parse the files.

@{
var master = (parameter) ? "Master1.cshtml" : "Master2.cshtml";
}
@MasterPageFile(master)

Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Martin

We do not support dynamic master pages currently... They are read and parsed the first time the layout template is used, and cannot change runtime.

BR Nicolai

Votes for this answer: 1

 

You must be logged in to post in the forum