Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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
  #1 (permalink)  
Old August 30th, 2006, 09:57 PM
Friend of Wrox
 
Join Date: Feb 2006
Location: , , USA.
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default really stupid problem with anchor tags

This is probably embarrasingly simple, yet I can't seem to figure it out. I have a web.sitemap, and a treeview that binds to that. My client wants internal anchors for a couple of the pages but they don't seem to be working...Here is the relevant part of the web.sitemap:

Code:
<siteMapNode url="~/Services/Accounting/Default.aspx" title="Accounting">
                <siteMapNode url="~/Services/Accounting/Default.aspx#general" title="General Accounting" />
                <siteMapNode url="~/Services/Accounting/Default.aspx#cfo" title="CFO Services" />
                <siteMapNode url="~/Services/Accounting/Default.aspx#special" title="Special Project Consulting" />
</siteMapNode>
At the bottom of the page, are three anchor tags that correspond to the links in the web.sitemap. Here is an example of one:

<a name="#general" />

At first I thought turning off MaintainScrollPositionOnBack would fix the problem. Here is my page directive at the top:

Code:
<%@ Page Language="VB" MaintainScrollPositionOnPostback="false" MasterPageFile="./accounting.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Outsourcing_Default" title="Veris > Outsourcing > Accounting & Financial Management" %>
So currently when I click on one of the internal links in the treeview, it does nothing. There is no post back, which is good. It does change the URL in the browsers URL bar, but it doesn't jump the viewport down to where that anchor tag resides.



Neil Timmerman
Programmer
Veris Consulting
  #2 (permalink)  
Old August 31st, 2006, 02:22 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You should drop the # mark from your <a> element:

<a name="general" />

Can you please add a few line breaks here and there when you post code? Thanks,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #3 (permalink)  
Old August 31st, 2006, 09:18 AM
Friend of Wrox
 
Join Date: Feb 2006
Location: , , USA.
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar...thanks! I knew I was doing something stupid.

That "code" button in the editor here prevents wrapping intentionally. While I think thats good for some things (makes it easier to read), I see your point: this one got a little wide. I'll be more mindful of that in the future.

Thanks again.

Neil

Neil Timmerman
Programmer
Veris Consulting
  #4 (permalink)  
Old August 31st, 2006, 09:34 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, correct. For languages where white space is important (Visual Basic for example), the non-wrapping code blocks are a good thing.

But, sometimes the lines get too wide, making it hard to read the page, or answer it.

Don't worry about it too much though....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stupid Problem with Example alanmdunsmuir BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 May 31st, 2006 08:55 AM
Generating anchor tags swwallace XSLT 3 March 8th, 2006 03:05 PM
Stupid problem tsimsha Pro VB 6 2 December 16th, 2004 12:45 PM
Anchor Tags don't work on iMac DenimDog HTML Code Clinic 3 October 30th, 2003 03:00 PM
Anchor Tags and the onClick event Blaise Javascript 4 June 16th, 2003 04:58 AM





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