如何动态更改母版页的母版页? [英] 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.
推荐答案
查看全文