Small things that is important to remember

1) If you want to add custom inline code in your master pages or page layouts:

  • Add the following line to your web.config file
  • <pageparserpaths>
  • <pageparserpath includesubfolders="true" allowserversidescript="true" compilationmode="Always" virtualpath="/*">
  • </pageparserpaths>
  • Mike Walsh

2) Add som inline code to switch master pages, for example, if you want to switch to printer friendly master page:

<script language=CS runat=server>

protected override void OnPreInit(EventArgs e)
SPWeb myWeb = SPControl.GetContextSite(Context).OpenWeb();
string strUrl = myWeb.ServerRelativeUrl + "/_catalogs/masterpage/print.master";
this.MasterPageFile = strUrl;


More code
Serge van den Oever

No comments: