Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 14th, 2012, 08:14 PM
Registered User
 
Join Date: Jul 2012
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default chap 12 page 389 step 10

I get this error message when save file and open to view in browser. I followed the book exactly went over code server times.
Server Error in '/Site7' 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 22: End If
Line 23: End If
Line 24: Select Case Page.Theme.ToLower()
Line 25: Case "darkgrey"
Line 26: Menu1.Visible = False


Source File: C:\Users\Owner\Desktop\Site7\MasterPages\MasterPag e.master.vb Line: 24

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
lstPreferredTheme.Page_Load(Object sender, EventArgs e) in C:\Users\Owner\Desktop\Site7\MasterPages\MasterPag e.master.vb:24
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
 
Old August 15th, 2012, 12:00 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,

Can you post the full code for the master page (markup and code behind), the BasePage and the web.config file?

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
__________________
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!
 
Old August 15th, 2012, 01:11 PM
Registered User
 
Join Date: Jul 2012
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is master page
<%@ Master Language="VB" CodeFile="ManagementMaster.master.vb" Inherits="MasterPages_ManagementMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div>
<div style="width: 200px; float: left;">
<ul>
<li><a href="~/Management/Default.aspx" runat="server">Management Home</a></li>
<li><a href="~/Management/Genres.aspx" runat="server">Manage Genres</a></li>
<li><a href="~/Management/Reviews.aspx" runat="server">Manage Reviews</a></li>
</ul>
</div>
<div style="width: 750px; float: left;">
<asp:ContentPlaceHolder ID="cpMainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</form>
</body>
</html>
and this is the web.config
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<pages theme=""></pages>
</system.web>
</configuration>
 
Old August 15th, 2012, 05:25 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ah, this is about the Management section, right? In that case, you should not use the custom template that inherits BasePage.

Instead, you need to create a new Web Form that simple inherits System.Web.UI.Page and that uses the Management Master Page.

Cheers,

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
Question about step 12 on page 94 bryman BOOK: Beginning iPad Application Development 4 December 20th, 2010 03:01 PM
Ch14 Page 500 Step 10 ken evans BOOK: Beginning ASP.NET 4 : in C# and VB 1 October 26th, 2010 02:54 PM
Ch13 Page 457 Step 12 ken evans BOOK: Beginning ASP.NET 4 : in C# and VB 1 October 25th, 2010 06:37 AM
page 167 Issue with Step 10. iPhoneNoob BOOK: Beginning iPhone SDK Programming with Objective-C 1 July 26th, 2010 11:49 AM





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