Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| 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 December 18th, 2009, 04:32 PM
Registered User
 
Join Date: Dec 2009
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
Default Chapter 8: User Controls: Page 281

When attempting update of control declaration on page 281, this line

Code:
   <Wrox:Banner ID="Banner1" runat="server" />
has green line under "Banner" and claims:

Code:
  Element 'Banner' is not a known element....
My web.config file has:

Code:
  <pages theme="Monochrome" >
   <controls>
     <add tagPrefix="Wrox" tagName="Banner" src="~/Controls/Banner.ascx"/>
   </controls>
  </pages>
What am I missing? I've stepped through this a couple of times.
Thanks, Mark
Reply With Quote
  #2 (permalink)  
Old December 18th, 2009, 04:39 PM
Registered User
 
Join Date: Dec 2009
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
Default Code Behind from Banner.ascx.cs

Here is the code behind from the control, Banner.ascx.cs

Code:
public partial class Controls_Banner : System.Web.UI.UserControl
{
	protected void Page_Load(object sender, EventArgs e)
	{
		pnlHorizontal.Visible = false;
		pnlVertical.Visible = false;

		switch (DisplayDirection)
		{
			case Direction.Horizontal:
				pnlHorizontal.Visible = true;
				break;
			case Direction.Vertical:
				pnlVertical.Visible = true;
				break;
		}
	}

	public Direction DisplayDirection { get; set; }


}
Reply With Quote
  #3 (permalink)  
Old December 18th, 2009, 04:46 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Mark,

Is the .ascx file indeed called Banner.ascx and located in the Controls folder? Is Controls located at the root of the site in the Solution Explorer? Is the Direction enum defined correct and does everything compile? (Choose Build | Build Web Site to test that out).

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!
Reply With Quote
  #4 (permalink)  
Old December 18th, 2009, 05:12 PM
Registered User
 
Join Date: Dec 2009
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
Default

filename: Banner.ascx in folder: /Controls off the root.

Direction.cs has only this text:

Code:
public enum Direction
{
	Horizontal,
	Vertical
}
Here are the errors when I try to compile:
Code:
Warning	2	Element 'Banner' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing.	Z:\idm\idmwebdev\MasterPages\MasterPage.master	40	10	Z:\idm\idmwebdev\
Error	3	'Controls_Banner.DisplayDirection.get' must declare a body because it is not marked abstract or extern	Z:\idm\idmwebdev\Controls\Banner.ascx.cs	30	38	Z:\idm\idmwebdev\
Error	4	'Controls_Banner.DisplayDirection.set' must declare a body because it is not marked abstract or extern	Z:\idm\idmwebdev\Controls\Banner.ascx.cs	30	43	Z:\idm\idmwebdev\
Error	5	z:\idm\idmwebdev\Controls\Banner.ascx.cs(30): error CS0501: 'Controls_Banner.DisplayDirection.get' must declare a body because it is not marked abstract or extern
Should this work under .NET 2.0?
Reply With Quote
  #5 (permalink)  
Old December 18th, 2009, 05:23 PM
Registered User
 
Join Date: Dec 2009
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
Default

OK, I think the problem is .NET 3.5. My web server hasn't been upgrade yet, so I was working as .NET 2.0.

All working well now.

Thanks much, and thanks for the book. Very good and giving one to a friend for Christmas.
Reply With Quote
  #6 (permalink)  
Old December 19th, 2009, 05:09 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
Thanks much, and thanks for the book. Very good and giving one to a friend for Christmas
Excellent. Good to hear you got it resolved, and even better to hear you like the book so much ;-)

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!
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
Chapter 8: User Controls - Shows all banners VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 April 9th, 2008 03:45 PM
User controls' content: Chapter 2 User Controls AGS BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 10 July 26th, 2007 05:36 AM
how can i access controls on parent page from user marvz ASP.NET 2.0 Basics 0 September 5th, 2005 11:18 PM
User controls not showing on web page pdr ASP.NET 1.0 and 1.1 Basics 0 August 10th, 2005 09:02 AM
Multiple user controls on a page kriskramer General .NET 2 September 14th, 2004 08:42 AM



All times are GMT -4. The time now is 05:14 PM.


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