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";
}
}
精彩评论