Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 28th, 2014, 01:11 PM
Registered User
Join Date: Aug 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 "Theme Dark Grey cannot be found"


I am on the "try it out" on page 231 and am having an issue;
I have added both the Monochrome and the Dark Grey themes to the site. I tried both themes out in the web.config page (<pages theme="DarkGrey" styleSheetTheme="DarkGrey"></pages>) switching back and forth and they both work perfectly. I have added the drop down and the page reloads but doesnt change the theme just as it is supposed to.

Now I have gotten onto "Applying the User-Selected Theme" on page 231 where I code the base page, and now since adding the code to the base page;
Private Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.PreInit
Dim preferredTheme As HttpCookie = Request.Cookies.Get("PreferredTheme")
If preferredTheme IsNot Nothing Then
Page.Theme = preferredTheme.Value
End If
End Sub

I keep getting a runtime error ;

Server Error in '/BegASPNET' Application.
Theme 'Dark Grey' cannot be found in the application or global theme directories.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Theme 'Dark Grey' cannot be found in the application or global theme directories.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): Theme 'Dark Grey' cannot be found in the application or global theme directories.]
System.Web.Compilation.ThemeDirectoryCompiler.GetT hemeBuildResultType(String themeName) +853
System.Web.Compilation.ThemeDirectoryCompiler.GetT hemeBuildResultType(HttpContext context, String themeName) +67
System.Web.UI.Page.InitializeThemes() +9529802
System.Web.UI.Page.PerformPreInit() +38
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +335

Yet when I remove that new section of code from the Base Page, it works fine again. What am I doing wrong? I don't get any errors in the error list and I was thinking it was because I spelled it "Dark Grey" instead of "DarkGrey" but that doesnt appear to be the issue anywhere I can see either. Any advice?

Thank you!
Old August 28th, 2014, 05:32 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi there,

Try clearing your browser's cookies. Looks like you have an old cookie from when the vale of the DropDownOption was called Dark Grey with a space.

Hope this helps; if not please post all the relevant code and I'll take a look.


Imar Spaanjaars
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
".axd file not found" stops functionality of PostBackUrl Mahesha999 BOOK: Professional IIS 7 and ASP.NET Integrated Programming ISBN 978-0-470-15253-9 0 July 5th, 2011 02:55 PM
Theme switching won't "stick" ksnortum BOOK: Beginning ASP.NET 4 : in C# and VB 5 December 6th, 2010 06:52 PM
Chapter 13 pictureDetails.aspx "The resource cannot be found" Rudy BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 November 24th, 2009 04:39 AM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM

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