|
 |
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 .
|
 |
|
|
 |

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

December 18th, 2009, 04:39 PM
|
Registered User
|
|
Join Date: Dec 2009
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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; }
}
|

December 18th, 2009, 04:46 PM
|
 |
Wrox Author
Points: 72,055, Level: 100 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
|
|
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
|

December 18th, 2009, 05:12 PM
|
Registered User
|
|
Join Date: Dec 2009
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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?
|

December 18th, 2009, 05:23 PM
|
Registered User
|
|
Join Date: Dec 2009
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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.
|

December 19th, 2009, 05:09 AM
|
 |
Wrox Author
Points: 72,055, Level: 100 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
|
|
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
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |