Hi Quade,
You can take a look at the implementation of System.Web.UI.Page.PerformPreInit method:
| private void PerformPreInit() |
| { |
| this.OnPreInit(EventArgs.Empty); |
| this.InitializeThemes(); |
| this.ApplyMasterPage(); |
| this._preInitWorkComplete = true; |
| } |
| |
To programmatically set themes, please follow these steps:
- Create a new class in the App_Code folder that inherits from Telerik.Cms.Web.InternalPage and override OnPreInit method. Enter your logic in this method (store information in cookie etc.).
| public class CustomPage : Telerik.Cms.Web.InternalPage |
| { |
| protected override void OnPreInit(EventArgs e) |
| { |
| base.OnPreInit(e); |
| this.Theme = "MyTheme"; |
| } |
| } |
| |
- Replace the declaration of InternalPage class with the name of your newly created class in the following file ~/Sitefinity/cmsentrypoint.aspx. The file should look like this:
| <%@ Page Language="C#" MasterPageFile="~/App_Master/Dummy.master" Inherits="CustomPage" %> |
| |
In this case we have set MyTheme dynamically as a theme of our site. Then you should create the dropdown box with your theme names as values.
Sincerely yours,
Georgi
the Telerik team