当前位置: 懒人建站 > MOSS界面定制 >

为Layouts中的页面应用站点母版页的方法

关键字: MOSS
为Layouts中的页面应用站点母版页的方法:需要在页面的OnPreInit方法里动态设置MasterPageFile属性为当前站点MasterUrl:

如果想把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>

 

来源:未知|发布人:懒人建站|2010-03-10|热度:|收 藏|分享到...|报 错

    分享到:


    相关文档
    登 录| 注 册