0
如何爲我的頁面選擇masterpage2,而我的頁面在運行時模式下並且已經使用masterpage1?使用c#語言的Web應用程序,母版頁
如何爲我的頁面選擇masterpage2,而我的頁面在運行時模式下並且已經使用masterpage1?使用c#語言的Web應用程序,母版頁
正是這樣的代碼是這裏的人誰發現了這個問題:(摘自@沙哈里亞爾的鏈接)
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";
}
}
你能改寫你的問題嗎?目前很難理解。 – 2010-11-01 06:28:27
我想你想運行時將你的.aspx的masterpage從1改爲2,對吧?這種變化背後的原因是什麼?由於masterpage是一種定義頁面結構的方式,並且改變它(甚至可以)可能會打破這種結構。如果你正在尋找皮膚,考慮動態注入的CSS或主題。 – xandy 2010-11-01 06:31:59