开发者

How do you dynamically assign a Master Page?

Is it possible to 开发者_开发知识库assign a Master Page dynamically?


Assign the master page in PreInit of the page whos MasterPage you wish to dynamically set:

protected void Page_PreInit(Object sender, EventArgs e)
{
    this.MasterPageFile = "~/YourMaster.master";
}


You can assign the master page during the Page_PreInit by using the MasterPageFile property.

Me.MasterPageFile = "~/masterpage.master"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜