I'm trying to add a theme to my masterpage (so its applied to all my content pages) programmatically. So far i have my master page with this:
<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
...And my "MasterPage.master.vb" code looks like this:
1 Partial Class MasterPage
2 Inherits System.Web.UI.MasterPage
3
4 Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
5 Page.Theme = CType(Session("default_theme"), String)
6 End Sub
7 End Class
I run one of my content pages (which are build from my masterpage) and it comes up with this "Exception Details: System.InvalidOperationException: The 'Theme' property can only be set in or before the 'Page_PreInit' event."
This may sound like a dumb question but why is this not working?
"ONE MASTERPAGE TO RULE THEM ALL"