zoukankan      html  css  js  c++  java
  • 如何使Layouts里的页面应用站点母板页

    今天有个朋友问这个问题,写一下~

    很简单,只要在页面的OnPreInit方法里动态设置MasterPageFile 属性为当前站点的MasterUrl即可: 

    protected override void OnPreInit(EventArgs e)
        {
            
    base.OnPreInit(e);

            
    if (SPContext.Current != null)
                Page.MasterPageFile 
    = SPContext.Current.Web.MasterUrl;
        }

     

    在aspx里就要这么写: 

    <script runat="server">
        
        protected override 
    void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);
            
    this.MasterPageFile = base.Web.MasterUrl;
        } 
        
    </script>

     自己开发的页面如果运行在SharePoint环境下也可这样来实现母板页的统一。

  • 相关阅读:
    Erlang/OTP:基于Behaviour的回调函数
    使用ACE创建进程
    linux查看硬件信息
    测试~~
    很好的:纠错函数linux
    转帖
    sss
    转帖
    普通函数、虚函数、纯虚函数、
    ACE_Event_Handle
  • 原文地址:https://www.cnblogs.com/jianyi0115/p/1299019.html
Copyright © 2011-2022 走看看