Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 9th, 2007, 04:52 PM
rav rav is offline
Authorized User
 
Join Date: Feb 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default theme selector

Hello: I have typed the exact same code of the Beer House project as given in the solution section of this book in c#.
But, I am not able to get the theme selector working...I am not getting any errors...when i select a different theme from the themeselector, it seems to be doing postback, but doesn't change the layout specified in the selected theme..don't know where the problem is...Is there any link from where I can download the code of first chapter and match with my code in order to firure out where I made the mistake..
I am beginner in .net... and i will appreciate nay help..
Thank you
rav
 
Old February 9th, 2007, 05:08 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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"
 
Old February 9th, 2007, 05:11 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

if you use c# version use this page to translate vb code...

http://carlosag.net/Tools/CodeTranslator/Default.aspx

Because it's a simple code you shouldn't have any problems...

 
Old February 12th, 2007, 12:44 AM
Authorized User
 
Join Date: Jan 2007
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check out this thread (it's about the same problem) and see if any of those solutions help. This may be a quick fix.

http://p2p.wrox.com/topic.asp?TOPIC_ID=55452







Similar Threads
Thread Thread Starter Forum Replies Last Post
theme selector from profile Maxxim BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 July 1st, 2007 10:35 PM
Theme Selector wont pick up other theme Tawanda BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 May 4th, 2007 08:44 AM
OptionButtons as workbook sheet selector frankjuel Excel VBA 8 February 27th, 2007 05:32 PM
theme selector inputcontrol highlight issue michaelitrn BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 10th, 2006 02:58 PM
Slot Selector motupally Classic ASP Basics 0 July 28th, 2003 05:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.