如何动态更改母版页? [英] How to dynamically change master page's master page?
本文介绍了如何动态更改母版页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试动态更改母版页,尽管从内容页面(覆盖 OnPreInit
)很容易做到,但母版页没有此类事件.可以通过某种方式介绍此活动吗?
I am trying to change the master page dynamically, and although it's easy to do from a content page (overriding OnPreInit
), there is no such event for a master page. Is it possible to introduce this event somehow?
更新:通过梯形图底部页面的 PreInit
,我到达了一半,事实证明您可以执行 base之类的事情.Master.MasterPageFile ="/master.Master";
,但是由于某些原因,这不会将内容加载到最顶层母版页页眉(即样式表)中.
UPDATE: I got halfway there by going via the PreInit
of the pages at the bottom of the ladder, turns out you can do things like base.Master.MasterPageFile = "/master.Master";
, but for some reason this doesn't load the stuff in the header of the top-most master page, namely stylesheets.
推荐答案
查看全文