开发者

Web application with c# language, Master page

开发者 https://www.devze.com 2023-01-23 02:39 出处:网络
how can 开发者_运维问答i select masterpage2 for my page whereas my page in run time mode and already use masterpage1?After a small search on google I found the following article.Just so the code is he

how can 开发者_运维问答i select masterpage2 for my page whereas my page in run time mode and already use masterpage1?


After a small search on google I found the following article.


Just so the code is here for anyone who finds this question: (Adapted from @Shaharyar's link)

protected void Page_PreInit(object sender, EventArgs e) 
{ 
 if () { //check for anything you like..

     this.Page.MasterPageFile = "~/General.master"; 
 } 
  else {
     this.Page.MasterPageFile = "~/myMaster.master";
 }
}
0

精彩评论

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