Loading

asp.net set theme

Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
            Dim id As String = Helpers.ThemesSelectorID

            If String.IsNullOrEmpty(id) = False Then

                ' 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)
                    Helpers.SetProfileTheme(PageProfile, 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(Helpers.GetProfileTheme(PageProfile)) Then
                        Me.Theme = Helpers.GetProfileTheme(PageProfile)
                    End If
                End If
            End If

        End Sub
from: TheBeerHouse
posted @ 2010-06-27 20:45  .net's  阅读(515)  评论(0)    收藏  举报