Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 January 28th, 2010, 02:30 PM
Registered User
 
Join Date: Jan 2010
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Applying the User-Selected Theme

Hello

This is related to the "Try it out" on page 226

I am currently trying to apply the second theme "Dark Grey" as the default theme is Monochrome. I followed the steps, made the changes in the BasePage in the App_Code folder saved all changes, and opened the page. But I cannot apply the "Dark Grey" theme as it still refreshes with Monochrome. I have a feeling I somehow inserted the code incorrectly or in the wrong order. I will insert the code below.

PHP Code:
using System;
using System.Web;

public class 
BasePage System.Web.UI.Page
{
    private 
void Page_PreRender(object senderEventArgs e)
    {
        if (
this.Title == "Untitled Page")
        {
            throw new 
Exception("Page title cannot be \"Untitled Page\".");
        }
    }
    private 
void Page_PreInit(object senderEventArgs e)
    {
        
HttpCookie preferredTheme Request.Cookies.Get("PreferredTheme");
        if (
preferredTheme != null)
        {
            
Page.Theme preferredTheme.Value;
        }
    }

    public 
BasePage()
    {
        
this.PreRender += new EventHandler(Page_PreRender);
        
this.PreInit += new EventHandler(Page_PreInit);
    }

Sorry for the trouble

*edit*

Problem solved. It was a typo on the code behind the drop down menu on the BasePage as shown below...

PHP Code:
HttpCookie preferredTheme = new HttpCookie("PreferredThene"); 
Silly me >_>

Last edited by Kerblamalot; January 28th, 2010 at 04:03 PM..
 
Old January 29th, 2010, 11:08 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

;-) Picky software.....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6 pps 226-228 User Selected Theme Featheriver BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 April 20th, 2011 07:08 AM
Ch 6 - User-Selected theme not working jennyWren BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 16 December 21st, 2009 03:52 PM
(Chapter 6) applying user-selected theme in IE7 phoenixx ASP.NET 3.5 Basics 6 August 26th, 2008 09:49 AM
Chapter 6 User-Selected Theme Question jabo2099 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 August 21st, 2008 03:45 AM
Applying Multiple Selected Values to a Listbox rit01 ASP.NET 2.0 Professional 1 December 15th, 2006 07:12 AM





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