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

December 18th, 2011, 03:55 PM
|
|
Authorized User
|
|
Join Date: Dec 2011
Posts: 43
Thanks: 11
Thanked 0 Times in 0 Posts
|
|
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
|
|

December 18th, 2011, 03:57 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Nick,
Can you post the markup for the control? Looks like you forgot the runat attribute.
Cheers,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

December 18th, 2011, 04:00 PM
|
|
Authorized User
|
|
Join Date: Dec 2011
Posts: 43
Thanks: 11
Thanked 0 Times in 0 Posts
|
|
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
|
|

December 18th, 2011, 05:31 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

December 19th, 2011, 09:45 AM
|
|
Authorized User
|
|
Join Date: Dec 2011
Posts: 43
Thanks: 11
Thanked 0 Times in 0 Posts
|
|
Got it working now, thank you for that Imar!
Nick
|
|
 |
|