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 June 25th, 2008, 06:26 PM
Registered User
 
Join Date: Jun 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 8 in VB.NET page 283

After I make the changes to the Page_Load procedure, then compile/run the website default.aspx, I get this error,

"Name 'Banner1' is not declared".

It says on the bottom part of the page to "verify that the banner user control has an ID of Banner1 in the mark-up view of the page", so I checked the MasterPage.master and this is the line that references the user control:

<Wrox:Banner ID="Banner1" runat="server" DisplayDirection = "Vertical" />

I don't know why I'm getting an error, any suggestion?




 
Old June 26th, 2008, 02:30 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi jensam,

Maybe you missed a few steps? The idea is to write this code in About.aspx, not in the Master Page.

Step 11 on page 282 shows you how to add a Banner control to the About page, resulting in the markup you posted here (<Wrox:Banner ID="Banner1" ...)

Step 1 on page 283 then says: "Open the Code Behind of AboutUs.aspx and add the following code.

So, the code in the Page_Load of AboutUs.aspx.vb talks to the control defined in the markup of AboutUs.aspx. The Master Page shouldn't have anything to do with it in this demo.

Hope this helps,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old August 18th, 2008, 05:08 AM
Registered User
 
Join Date: Aug 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello jensam

I also missed the step 11 on page 282, after adding the banner.ascx control into the aboutus.aspx i got the problem solved.

But i am curious already there is a banner control in master page with id "Banner1" and now another banner control in the aboutus.aspx page with the banner id "Banner1". Won't there be a conflict when the page loads with both master and aboutus.aspx with these banner id's.

MalarCodes



 
Old August 19th, 2008, 08:02 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

In the .NET framework, there are two "TextBox" classes:

System.Windows.Forms.TextBox
System.Web.UI.WebControls.TextBox

They don't conflict because they are in two different namespaces. Think of your question in that regard. Yes, you have a "Banner1" in two places however, they are in different places in a control hierarchy. One is in the master page's controls and one in the page's content placeholder. If you look at the HTML that is emitted to the browser for the aboutus.aspx page, you'll see two distinct controls names:

ctl00_cpMainContent_Banner1 - This is the horizontal banner in the page's content.
ctl00_Banner1 - This is the one that lives in the master page.

Note: Unless explicitly named, the top level master page control will typically be "ctl00".

-Peter
compiledthoughts.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 1.1 with VB.NET 2003 chapter 1 subroger Wrox Book Feedback 2 November 11th, 2004 12:52 PM
Beg. ASP.Net eCommerce with VB.Net - Chapter 5 James Hendrix All Other Wrox Books 0 October 22nd, 2003 10:45 PM





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