Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 2nd, 2010, 08:42 PM
Authorized User
Points: 77, Level: 1
Points: 77, Level: 1 Points: 77, Level: 1 Points: 77, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 15
Thanks: 8
Thanked 0 Times in 0 Posts
Default ASP4-problems with NavigateUrl property

Hi everyone
Windows 7;
VS2010;
I'm having a weird problem with NavigateUrl property in chapter 8, page 290.
Its a "TryItOut" session, and the problem is in step 5.
until that step everything is fine.
By adding
Code:
 runat="server" id="VerticalLink"
as requested to the line
Code:
<a href="http://p2p.wrox.com" target="_blank" >
in Banner.ascx, some troubles start.
Ive noticed some errors in step 9, when i got a page with error message in the browser intead of the page AboutUs.aspx.
I went backwards, undo actions until i undo step 5, and errors were gone from the error list and the build went fine.
Now, I've decided to do the instructions in step 5 again, so now In Banner.ascx, I have the following line(according to the book,its fine):
Code:
 <a id="VerticalLink" runat="server" href="http://p2p.wrox.com" target="_blank" >
Now when choose build solution i get 4 errors in the erros list, all the same: "Unexpected end of file looking for </a> tag."
Now before step 5, everything went fine, and build finished ok, so i dont know why step 5, which is really noting then adding 2 attributes to the anchor element breaks everything...

10x for any reply people...

Last edited by stormage; June 2nd, 2010 at 08:49 PM..
Reply With Quote
  #2 (permalink)  
Old June 3rd, 2010, 03:27 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

Maybe the error message is just correct and you don't have a closing </a>?

Without runat="server", <a href=.... > is just plain HTML. If it's syntax is invalid, it does not generate error (it may generate a warning though). However, by adding that attribute you turn it into a server control. To successfully parse and create a server control, it's syntax must be valid, and thus the closing </a> is required.

Hope this helps; if not, please post the rest of the relevant code from the page as well.

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
  #3 (permalink)  
Old June 3rd, 2010, 12:02 PM
Authorized User
Points: 77, Level: 1
Points: 77, Level: 1 Points: 77, Level: 1 Points: 77, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 15
Thanks: 8
Thanked 0 Times in 0 Posts
Default

Hi Imar,
Its really weird...
when the code is written whis way in Banner.ascx:
Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Banner.ascx.cs" Inherits="Controls_Banner" %>
<asp:Panel ID="VerticalPanel" runat="server">
  <a href="http://p2p.wrox.com" target="_blank" runat="server" id="VerticalLink" >
    <asp:Image ID="Image1" runat="server" AlternateText="This is a sample banner" 
    ImageUrl="~/Images/Banner120x240.gif" /> 
                                                  
  
  </a> 
  <br />
  <br />
</asp:Panel>
I get errors, but when its written like this:
Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Banner.ascx.cs" Inherits="Controls_Banner" %>
<asp:Panel ID="VerticalPanel" runat="server">
  <a href="http://p2p.wrox.com" target="_blank" runat="server" id="VerticalLink" >
    <asp:Image ID="Image1" runat="server" AlternateText="This is a sample banner" 
    ImageUrl="~/Images/Banner120x240.gif" /> </a> 
                                                  
  <br />
  <br />
</asp:Panel>
I get no errors at all.
i dont get it, because all i did is relocate the closing anchor tag and put it closer at the same line and not under the last code.
But now it works.
10x for your time

Last edited by stormage; June 3rd, 2010 at 12:09 PM..
Reply With Quote
  #4 (permalink)  
Old June 3rd, 2010, 12: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

Are you sure that this is really the case? Both examples work fine for me....

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
  #5 (permalink)  
Old June 3rd, 2010, 01:14 PM
Authorized User
Points: 77, Level: 1
Points: 77, Level: 1 Points: 77, Level: 1 Points: 77, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 15
Thanks: 8
Thanked 0 Times in 0 Posts
Default

Yes, I'm sure
I dont get it, but it works now
I'm installing VS2010 on my other machine, in order to deal with cases such as this, because it seems like local problem on my machine if it works for you.
Any way, 10x for helping Imar..
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
having problem with NavigateUrl - page 285 sarala BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 August 4th, 2010 08:07 AM
Chapter 8 NavigateURl ChuckASP BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 March 7th, 2010 07:52 AM
chp 01, get[property name] and set[property name] sandeepgreaternoida BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 0 May 12th, 2009 01:12 AM
NavigateUrl and Target spacy ASP.NET 1.x and 2.0 Application Design 9 November 5th, 2007 12:23 PM
Strange Problem with NavigateUrl in TreeView kalchev ASP.NET 2.0 Basics 3 May 2nd, 2006 02:38 AM



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


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