Master page different layouts
Better to explain with the example. :)
Let's say that I have two master pages (or more). The first master page have some plain layout with two content place holders and the second master page have more complex layout with four content place holders.
When I am manually creating a page to use each of the开发者_如何转开发 master pages, VS will add the content place holders according to place holders inside the selected master page.
My question is how can I do the same thing programatically?
I have seen skins and templates, but that just change the appearance of the page, not layouts itself.
Thanks.
I hope it meet your need!
in new pages constructor implement this:
this.MasterPageFile = "master page file name";
this.Controls.Add(new Content().ContentPlaceHolderID = "name of ContentPlaceHolder in Selected Master Page!");
精彩评论