Select parent nodes in sitemap when any of its children are selected

D

Dave Mathew

I'm in the process of building some navigation for a website. I would
like to use the capabilities of the sitemap in asp.net but have ran
into some styling/usability issues in the past using just the default
controls that consume the sitemap. I'd like to know of there is a
correct/recommended way of doing the following:

1.. Build a horizontal navigation bar with a set of top level
navigation

2. When a child page is selected the parent node on the navigation bar
should be selected as well

3. When a child page is selected under the parent node but uses a
query string or an implied file name it should also select the parent
node.

Here's some examples:

-- Problem #1: / and /default.aspx no the the same in the eyes of
the sitemap
If I had a parent navigation bar category called Books, then went
to example.com/Books/Default.aspx the sitemap as-is would recognize to
highlight the books category. I also want this to happen when I go to
example.com/Books where Default.aspx is what is loaded by IIS but it
is not explicitly stated when the user enters the URL, when using the
default sitemap functionality in asp.net the sitemap does not
recognize that Default.aspx is selected since its not explicitly
expressed in the url. How would I make example.com/Books and
example.com/Books/Default.aspx equivalent to the controls consuming
the sitemap?
-- Problem #2:
Let's say that I have the same books category but I also have
another page called Meetups.aspx under it. When this page is selected
I also want the books category / parent node to realize it is selected
and display as such in my navigation bar. I also want parent to select
when a query string is used on this page. i.e. Meetups.aspx?
sate=IN&zip=46032 should also highlight the Books parent node and
ideally would be the same as Meetups.aspx when not using the query
string. The default asp.net sitemap controls don't seem to allow this
either.


The last time I worked with sitemaps was in .NET 2.0, and I'm now
using 3.5, didn't know if the support for sitemaps are any better in
the new version? Is thee a correct way to get this functionality from
the out of the box controls or will I have to code my own custom
solution? Any suggestions or references to resources would help.
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top