Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 9th, 2007, 04:52 PM
rav rav is offline
Authorized User
 
Join Date: Feb 2007
Location: , , .
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
  #2 (permalink)  
Old February 9th, 2007, 05:08 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
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"
  #3 (permalink)  
Old February 9th, 2007, 05:11 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
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...

  #4 (permalink)  
Old February 12th, 2007, 12:44 AM
Authorized User
 
Join Date: Jan 2007
Location: , , .
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


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:32 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.