Since SharePoint is built on the ASP.Net 2.0 framework, you can take advantage of the same code that you would use in an ASP.Net application. One of these that is useful in SharePoint is the ability to change the master page programmatically at run time.
This is easily enough accomplished through the use of the Page.MasterPageFile property. It is important to note that you need to use this property in the Page_PreInit method as this is the earliest point that you can access the Page lifecycle. It is also the only point that you can affect both the master and content page before they are combined into a single instance.
You can use this property to change the master page for a single page inside a site since with SharePoint you can only change the master pages for an entire site through the SharePoint UI.
No comments:
Post a Comment