我想要为所有 GuiPlugIn 报告创建自定义母版页。众所周知,默认情况下 GuiPlugIn 引用 EPiServerUI.master 页面,这是安装的一部分。我想为我的 GuiPlugIn 创建一个嵌套母版页而不是默认母版页。
请分享您的想法。
谢谢, 克里斯
最佳答案
我认为不能更改插件的母版页的原因是为了视觉一致性。您可以尝试通过这样的代码更改母版页(假设您的插件是用户控件:
protected override void OnInit(EventArgs e)
{
this.Page.MasterPageFile = "~/NewMaster.master";
}
如果您提供更多详细信息,也许有更好的方法来完成您想要的事情?
如果您想注入(inject)自定义 CSS 或脚本以与您的插件一起使用,您始终可以访问 Page 对象,如下所示:
HtmlGenericControl js = new HtmlGenericControl("script");
js.Attributes["type"] = "text/javascript";
js.Attributes["src"] = "mylibrary.js";
this.Page.Header.Controls.Add(js);
关于来自 EPiServerUI.master 的 Episerver 嵌套母版页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10928981/