 |
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
|
|
|
|
|

August 10th, 2012, 03:02 PM
|
|
Registered User
|
|
Join Date: Aug 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

August 10th, 2012, 03:05 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

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

August 10th, 2012, 04:58 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

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

March 16th, 2013, 03:26 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
 |
|