Can I change a nested master page's master dynamically?
问题 Okay, so we all know about changing a master page dynamically in a page's OnPreInit event. But what about a nested master page? Can I change a master's master? There is no OnPreInit event exposed in the MasterPage class. Any ideas? 回答1: Just tested this and it works from the PreInit of the Page that is using the nested MasterPage. protected void Page_PreInit(object sender, EventArgs e) { this.Master.MasterPageFile = "/Site2.Master"; } Obviously you will need to ensure that the