Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 15th, 2012, 02:16 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Error after 1st exercise chapter 10

Hi,

In Chapter 10, I tried the first exercise. Step 6 says that I have to save the changes and open the page (UpdatePanel.aspx) in my browser. But then I got this error:

Server Error in '/' Application.

Object reference not set to an instance of an object.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
MasterPages_Frontend.Page_Load(Object sender, EventArgs e) +227
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Control.LoadRecursive() +146
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207


I deleted the UpdatePanel.aspx page from the project but still I get the same error, no matter which page I try to view in the browser. I found out it has something to do with this line in the code behind the masterpage:

Select Case Page.Theme.ToLower

Until this exercise this code worked fine, but now it doesn't anymore, maybe I accidently changed something when I tried to insert the label and button control in this exercise? Can someone help me?
Reply With Quote
  #2 (permalink)  
Old May 15th, 2012, 04:09 PM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Did you remove the theme attribute from the web.config file by accident?

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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
Wolfman2500 (May 15th, 2012)
  #3 (permalink)  
Old May 15th, 2012, 04:30 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Yes, there was no theme in the web config file.

I had this code:

Code:
<pages>
        <controls>
          <add tagPrefix="Wrox" tagName="Banner" src="~/Controls/Banner.ascx"/>
        </controls>
      </pages>

After I changed it to this:

Code:
<pages theme="Monochrome">
        <controls>
          <add tagPrefix="Wrox" tagName="Banner" src="~/Controls/Banner.ascx"/>
        </controls>
      </pages>
It works again! Thank you very much!
Reply With Quote
  #4 (permalink)  
Old September 7th, 2012, 05:59 PM
Registered User
Points: 38, Level: 1
Points: 38, Level: 1 Points: 38, Level: 1 Points: 38, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Posts: 8
Thanks: 2
Thanked 1 Time in 1 Post
Default This happened to me...but how did this theme get removed?

It has been a while since I have had time to come back to this book. I left off at Chapter 15. Now that I started back up I had this same issue. None of my websites were working and I was getting this same error.

I had to add the code
Code:
 <pages theme="Monochrome">
and now it works? How did this get removed from my web.config file? Everything worked before...I come back after a few weeks and it wasn't working.
Reply With Quote
  #5 (permalink)  
Old September 8th, 2012, 04:26 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

The theme is set by a cookie, so maybe you don't have one, or your browser doesn't accept them? (Or it had expired?).

The theme in web.config like in your code serves as the default theme for visitors that don't have a theme cookie (yet).

Hope this helps,

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!
Reply With Quote
Reply


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
1st Watermark Putting All Together exercise not working Notso BOOK: Beginning ASP.NET 4 : in C# and VB 5 December 23rd, 2011 03:59 AM
Chapter 16: 1st 'Try It Out' Web.config error jee26 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 September 21st, 2008 09:35 AM
Chapter 2 - 1st exercise gomesdir BOOK: Beginning JavaServer Pages 4 April 6th, 2006 08:13 PM
Chapter 10 Enhanced File Info Display exercise err ssn651 BOOK: Beginning ASP 3.0 8 August 27th, 2003 10:35 AM



All times are GMT -4. The time now is 03:30 PM.


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