Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 December 18th, 2011, 03:55 PM
Authorized User
 
Join Date: Dec 2011
Posts: 43
Thanks: 11
Thanked 0 Times in 0 Posts
Default Chapter 8 page 328 problem.

Hi, I am working on the exercise starting on page 326 in Chapter 8 about Implementing the NavigateUrl property.

On step 6 it asks you to modify the Page_Load handler of the user control so it also sets the HRef property of the anchor element.

It asks you to insert these lines of code into my user control...
HorizontalLink.HRef = NavigateUrl;and
VerticalLink.HRef = NavigateUrl;
The problem I am having is that it isnt accepting those lines of code. It seems that I am missing the service references in order for it to accept the "HRef" part. I have looked it up and inserted the assembly reference
"using System.Web.UI.HtmlControls.HtmlAnchor;" but still no luck.

Any help would be appreciated,

Thanks, Nick
 
Old December 18th, 2011, 03:57 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 Nick,

Can you post the markup for the control? Looks like you forgot the runat attribute.

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!
The Following User Says Thank You to Imar For This Useful Post:
Nick Makin (December 18th, 2011)
 
Old December 18th, 2011, 04:00 PM
Authorized User
 
Join Date: Dec 2011
Posts: 43
Thanks: 11
Thanked 0 Times in 0 Posts
Default

Hi Imar, yeah here it is...

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Banner.ascx.cs" Inherits="Controls_Banner" %>
<asp:Panel ID="VerticalPanel" runat="server">
<a href="http://p2p.wrox.com"><asp:Image ID="VerticalLink" runat="server" AlternateText="This is a sample banner"
ImageUrl="~/Images/Banner120x240.gif"/></a>>
</asp:Panel>
<asp:Panel ID="HorizontalPanel" runat="server">
<a href="http://p2p.wrox.com"><asp:Image ID="HorizontalLink" runat="server" AlternateText="This is a sample banner"
ImageUrl="~/Images/Banner468x60.gif"/></a>>
</asp:Panel>



Just a little point, before this exercise the image id's where Banner 2 and Banner 1 respectively. I changed them to Vertical/Horizontal in step 5.

Thanks, Nick
 
Old December 18th, 2011, 05:31 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Step 5 explains how to *add* a runat and id attribute to the outer <a> element; i.e. to the link. It looks like you added / updated them on the inner Image control instead. Take a look at the code in step 5 to see what I mean.

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!
The Following User Says Thank You to Imar For This Useful Post:
Nick Makin (December 19th, 2011)
 
Old December 19th, 2011, 09:45 AM
Authorized User
 
Join Date: Dec 2011
Posts: 43
Thanks: 11
Thanked 0 Times in 0 Posts
Smile

Got it working now, thank you for that Imar!

Nick





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9, page 328, Hosting Silverlight Application peterkao87 BOOK: Beginning SharePoint 2010 Development 0 November 27th, 2011 10:16 AM
problem on page 93 Chapter 3 aformoftruth BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 2 January 23rd, 2010 12:36 AM
Chapter 10 Try it Out (Page 328) IDE Question: jsymons BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 September 9th, 2009 03:06 PM
chapter 2 - page 41 problem creating the page.. jorjiana BOOK: Beginning Oracle Application Express ISBN: 9780470388372 2 August 22nd, 2009 04:25 AM
Problem with Chapter 2 First Page xtiano77 ASP.NET 3.5 Basics 1 May 7th, 2008 01:00 AM





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