Wrox Programmer Forums
|
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 May 15th, 2012, 02:16 PM
Registered User
 
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?
 
Old May 15th, 2012, 04:09 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,

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!
The Following User Says Thank You to Imar For This Useful Post:
Wolfman2500 (May 15th, 2012)
 
Old May 15th, 2012, 04:30 PM
Registered User
 
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!
 
Old September 7th, 2012, 05:59 PM
Registered User
 
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.
 
Old September 8th, 2012, 04:26 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!





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





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