The chpater 2 don't refer globals class! But you have to do it in order to see theme selector works...
Make a new class
global on your app_code:
Code:
Imports System.Web.Configuration
Imports Microsoft.VisualBasic
Namespace MB.TheBeerHouse
Public NotInheritable Class Globals
Public Shared ReadOnly Settings As TheBeerHouseSection = _
CType(WebConfigurationManager.GetSection("theBeerHouse"), TheBeerHouseSection)
Public Shared ThemesSelectorID As String = ""
End Class
End Namespace
If it doesn't work yet, verify your
basepage:
It must be like this:
Code:
Protected Overrides Sub OnPreInit(ByVal e As System.EventArgs)
Dim id As String = Globals.ThemesSelectorID
If id.Length > 0 Then
''Dim profTheme As ProfileCommon = HttpContext.Current.Profile
' if this is a postback caused by the theme selector's dropdownlist,
' retrieve the selected theme and use it for the current page request
If Me.Request.Form("__EVENTTARGET") = id AndAlso _
Not String.IsNullOrEmpty(Me.Request.Form(id)) Then
Me.Theme = Me.Request.Form(id)
Me.Session("CurrentTheme") = Me.Theme
''profTheme.Preferences.Theme = Me.Theme
Else
' if not a postback, or a postback caused by controls other then the theme selector,
' set the page's theme with the value found in the user's profile, if present
If Not String.IsNullOrEmpty(Me.Session("CurrentTheme")) Then
Me.Theme = Me.Session("CurrentTheme").ToString()
End If
End If
End If
MyBase.OnPreInit(e)
End Sub
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
Helpers.SetInputControlsHighlight(Me, "highlight", False)
MyBase.OnLoad(e)
End Sub
Some chapters ahead you'll have to alter this code because you don't do this by session variable but by "profTheme.Preferences"