开发者

How do you dynamically assign a Master Page?

开发者 https://www.devze.com 2023-01-16 10:02 出处:网络
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:

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

精彩评论

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

关注公众号