Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 June 25th, 2008, 06:26 PM
Registered User
 
Join Date: Jun 2008
Location: , , .
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?




Reply With Quote
  #2 (permalink)  
Old June 26th, 2008, 02:30 AM
Imar's Avatar
Wrox Author
Points: 72,019, Level: 100
Points: 72,019, Level: 100 Points: 72,019, Level: 100 Points: 72,019, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,075
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #3 (permalink)  
Old August 18th, 2008, 05:08 AM
Registered User
 
Join Date: Aug 2008
Location: , , .
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



Reply With Quote
  #4 (permalink)  
Old August 19th, 2008, 08:02 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
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
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



All times are GMT -4. The time now is 11:49 AM.


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