View Single Post
  #1 (permalink)  
Old September 4th, 2008, 03:22 AM
mikeal_a mikeal_a is offline
Registered User
 
Join Date: Sep 2008
Location: Phoenix, AZ, .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7 Object reference error in master.cs

I'm on Chapter 7 (page 255 C#) and am getting the error listed below when attempting to view the default.aspx page in the browser. It started happening right when I added the "switch (Page.Theme.ToLower())" in the master page behind code. Specifically the line "TreeView1.Visible = true;" is causing the error. Any ideas? Everything was working fine up till this point.

Thanks in advance.


Server Error in '/' Application.
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 35: case "darkgrey":
Line 36: Menu1.Visible = false;
Line 37: TreeView1.Visible = true;
Line 38: break;
Line 39: default:


Source File: c:\Documents and Settings\Home\My Documents\Visual Studio 2008\WebSites\WebSite1\MasterPages\MasterDemo.mast er.cs Line: 37

[NullReferenceException: Object reference not set to an instance of an object.]
   MasterPages_MasterDemo.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\Home\My Documents\Visual Studio 2008\WebSites\WebSite1\MasterPages\MasterDemo.mast er.cs:37
   System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

Reply With Quote