Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 159765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:54:59+00:00 2026-05-11T10:54:59+00:00

I’ve had a good look through a load of MS documentation only to find

  • 0

I’ve had a good look through a load of MS documentation only to find a tree view like structure to the use of sitemaps. I don’t suppose anyone’s aware of how it’s possible to have a folder-like structure for sitemap navigation? Take for example a structure as follows

Home    About       Me.aspx       MyFamily.aspx       MyPets.aspx    Contact       Telephone.aspx       Email.aspx  Disclaimer.aspx 

The ‘About’ and ‘Contact’ would be folders, but the sitemap is never hierarchical on a single page. So, I would have my root page with two menu items, one would be ‘Home’ which acts like a folder to drill down into the about and contact menus, and the other is a link to the page for the disclaimer. I want to be able to click on Home which will reload the menu with the links for ‘About’ and ‘Contact’ and hide ‘Home’ and ‘Disclaimer’ altogether.

Home > Disclaimer 

Then click on home and you would get

About > Contact > 

Then when clicking on about you’d get

Me My Family My Pets 

Every menu would have an ‘up’ menu to come back out a folder.

I can’t see there being an easy solution, but at the moment we use static html pages that are in different folders all over our web application. This is something that needs changing as you can well imagine.

Any ideas?

EDIT

I’ve had to come up with a VB.NET solution

<script runat='server'>   Private Function GetSecondaryNavItems() As String     Dim sRet As String = ''      Dim oCurrNode As System.Web.SiteMapNode = Nothing     Dim oCurrParentNode As System.Web.SiteMapNode = Nothing      'Dim sCurrPage As String = GetURL(Request.ServerVariables('SCRIPT_NAME').ToLower())     Dim sCurrPage As String = GetURL(HttpContext.Current.Request.ServerVariables('SCRIPT_NAME').ToLower())     oCurrNode = GetCurrentNode(sCurrPage, SiteMap.RootNode)      If Not oCurrNode Is Nothing Then       oCurrParentNode = oCurrNode.ParentNode     End If      If Not oCurrParentNode Is Nothing Then       If Not oCurrParentNode Is SiteMap.RootNode Then         sRet += 'Parent Folder Link'          If Not oCurrNode Is Nothing Then           For Each oChild As SiteMapNode In oCurrParentNode.ChildNodes             sRet += 'Link for child'           Next         End If       End If     End If      Return sRet   End Function    Private Function GetURL(ByVal fullURL As String) As String     Return fullURL.Substring(fullURL.LastIndexOf('/'))   End Function    Private Function GetCurrentNode(ByVal _sCurrentPageURL As String, ByVal _oNode As SiteMapNode) As SiteMapNode     Dim oNodeRet As SiteMapNode = Nothing      For Each oNodeCheck As SiteMapNode In _oNode.ChildNodes       If oNodeCheck.HasChildNodes = True Then         oNodeRet = GetCurrentNode(_sCurrentPageURL, oNodeCheck)       End If        If oNodeRet Is Nothing Then         Exit For       End If        Dim sURL As String = oNodeCheck.Url.ToLower()       Dim iPos As Integer = sURL.IndexOf('?')        If iPos > 0 Then         sURL = sURL.Substring(0, iPos)       End If        iPos = sURL.LastIndexOf('/')        If iPos > 0 Then         sURL = sURL.Substring(iPos)       End If        If sURL = _sCurrentPageURL Then         oNodeRet = oNodeCheck         Exit For       End If     Next      Return oNodeRet   End Function </script> 

This is in the master page file directly (temporary, I’ll place it in the code behind model later).

I’ve then got this in the body

<div id='sidebar'>   <%= GetSecondaryNavItems() %> </div> 

Again, temporarily just to test. It doesn’t actually output anything but then I’m thinking my GetURL definition is incorrect. I was assuming it was just getting the actual file? I could be very wrong though 🙂

EDIT EDIT: For some reason I’m not getting any output, so I thought it was my sitemap. I’ll need to debug it but I’m remoting in at the moment so it’s quite slow 😉

<?xml version='1.0' encoding='utf-8' ?> <siteMap xmlns='http://schemas.microsoft.com/AspNet/SiteMap-File-1.0' >   <siteMapNode url='Accounts/Default.aspx' title='Accounts'  description='Accounts'>     <siteMapNode url='Accounts/Test.aspx' title='Client Balances' description='Client Balances'>       <siteMapNode url='Hello.aspx' title='Hello'  description='rarar' />       <siteMapNode url='Hiya.aspx' title='Hiya'  description='rarar' />     </siteMapNode>     <siteMapNode url='Test.aspx' title='Test'  description='rarar' />   </siteMapNode> </siteMap> 

Here’s the example sitemap.

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:55:00+00:00Added an answer on May 11, 2026 at 10:55 am

    You could still use the Sitemap.sitemap file to control your navigation, but you wouldn’t use any of the built-in controls in asp.net to achieve this. I just did almost this very thing on a site I just finished.

    Make all of your pages inherit from a base page class (or use master pages, either way you’ll only have 1 copy of your code.)

    Create a div or span on each page, named something appropriate (divNav or spnNav or whatever).

    In your base page, on page load, loop through all the sitemap nodes to find the current page’s node. This needs to be a recursive call.

        // Pass the current page url, all the way through the .aspx.  In other words, do NOT pass any kind of      // query string.     private SiteMapNode GetCurrentNode(string _sCurrentPageURL, SiteMapNode _oNode)     {         SiteMapNode oNodeRet = null;          foreach (SiteMapNode oNodeCheck in _oNode.ChildNodes)         {             if (oNodeCheck.HasChildNodes == true)             {                 oNodeRet = GetCurrentNode(_sCurrentPageURL, oNodeCheck);             }              if (oNodeRet != null)                 break;              string sUrl = oNodeCheck.Url.ToLower();             int iPos = sUrl.IndexOf('?');             if (iPos > 0)                 sUrl = sUrl.Substring(0, iPos);             iPos = sUrl.LastIndexOf('/');             if (iPos > 0)                 sUrl = sUrl.Substring(iPos);              if (sUrl == _sCurrentPageURL)             {                 oNodeRet = oNodeCheck;                 break;             }         }         return oNodeRet;     } 

    Once you have the current node, get its parent.

    Add a link (the ‘up menu to come back out a folder’ as you called it).

    Then do a foreach(SiteMapNode in parent.ChildNodes)

    Add a link for each of the children.

    So, our main call, that we called on every page load, was like this:

        public string GetSecondaryNavItems()     {         string sRet = '';          // Get the node that matches most of this url...         System.Web.SiteMapNode oCurrNode = null;         System.Web.SiteMapNode oCurrParentNode = null;          string sCurrPage = GetURL(Request.ServerVariables['SCRIPT_NAME'].ToLower());          oCurrNode = GetCurrentNode(sCurrPage, SiteMap.RootNode);          if(oCurrNode != null)             oCurrParentNode = oCurrNode.ParentNode;          if(oCurrParentNode != null)               if(oCurrParentNode != SiteMap.RootNode)                   sRet += 'Parent Folder link';              if(oCurrNode != null)             {             foreach (System.Web.SiteMapNode oChild in oCurrParentNode.ChildNodes)             {                     sRet += 'Link for child';               }         }     } 

    I have to tell you that the code above is part copied and part freehanded by me. But this should give you a good start, I would think.

    EDIT: So sorry! Here is the GetURL proc…

        public string GetURL(string _sURL)     {         string sRet = _sURL;          int iPos = sRet.IndexOf('?');         if (iPos > 0)             sRet = sRet.Substring(0, iPos);         iPos = sRet.LastIndexOf('/');         if (iPos > 0)             sRet = sRet.Substring(iPos);          return sRet;     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.