Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 August 10th, 2012, 03:02 PM
Registered User
 
Join Date: Aug 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 - using VB, can't apply theme dynamically

I have not been able to get the ThemeList dropdown to work properly. I created the cookie to have DarkGrey set for my preferredTheme, but when I select Monochrome from the dropdown the theme says set at DarkGrey and the dropdown selection reverts to DarkGrey.

I reviewed my code very carefully and it appeared to match the instructions perfectly. Finally, I copied and pasted all of the Source code (BasePage, Frontend, Default) from the downloaded files and replaced my site code and it still behaves the same as I have described.

Any ideas on what my be going wrong?

Thanks.
 
Old August 10th, 2012, 03:05 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

That's odd. The code from my book should work Did you name the Monochrome folder exactly that? And does your brwoser support cookies? And does it work in other browsers?

If none of this helps, can you post markup and code behind for the Master Page, the BaseBase and the web.config?

If you post code, can you please paste it in Notepad first to remove color coding and then use the forum editor's Code toolbar button to wrap your code in code tags. Otherwise, this forum messes up the code.

Cheers,

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!
 
Old August 10th, 2012, 04:28 PM
Registered User
 
Join Date: Aug 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I fixed the problem. The Book and Source both called the Cookie "PreferredTheme". I changed it to "preferredTheme" and the code now works perfectly.

I am using IE 9. I did not try the original code with another browser.

Thanks for the quick reply.
 
Old August 10th, 2012, 04:58 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

That sounds like you had a cookie with a bad value. Choosing a new name creates a new cookie, ignoring the older one. Clearing your browser's cookies would probably have solved the problem as well.

Cheers,

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!
 
Old March 16th, 2013, 12:31 PM
Registered User
 
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am having the same problem. I cleared my cookies and still the drop down wont change the theme. It appears the page does a postback (as it flashes) but the theme wont change.

I have tried on Firefox and IE. Cookies are enabled on both.

Edited:
Well I compared my code to the code from the download, and then reread the Try it out...#6 on page 229 says "the theme wont change because there is code we need to add to apply the theme". So at this point the site is working as described... the selected theme (IN THE DROP DOWN) is staying to what was selected.

On to adding code to make the theme change.

Last edited by lindahodges; March 16th, 2013 at 01:55 PM.. Reason: solved my own question
 
Old March 16th, 2013, 03:26 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Indeed! I was just going to suggest adding the code for Page_PreInit in the BasePage class to apply the theme.... ;-)

Glad you figured it out.

Cheers,

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
Theme dissapeared in chapter 7 robochrish BOOK: Beginning ASP.NET 4 : in C# and VB 2 May 15th, 2012 10:15 AM
Chapter 6 - theme not changing granola911 BOOK: Beginning ASP.NET 4 : in C# and VB 1 January 4th, 2012 09:34 AM
Apply page theme ryanburnett BOOK: Beginning ASP.NET 4 : in C# and VB 20 September 17th, 2010 09:51 AM
VB.net 2005 User theme datagrid alex1985 Visual Studio 2005 7 September 11th, 2007 01:34 PM
apply css class to dynamically generated table row nikeshkm Javascript 2 September 28th, 2006 03:52 AM





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