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 6532703
In Process

The Archive Base Latest Questions

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

I have an XML Sitemap like this <?xml version=1.0 encoding=utf-8 ?> <Menu> <MenuItem Name=Page

  • 0

I have an XML Sitemap like this

<?xml version="1.0" encoding="utf-8" ?>
<Menu>
    <MenuItem Name="Page 1" Url="~/page1.aspx">
        <MenuItem Name="SubPage 1" Url="~/subpage1.aspx" />
    </MenuItem>
    <MenuItem Name="Page 2" Url="~/page2.aspx">
        <MenuItem Name="SubPage 1" Url="~/subpage1.aspx" />
        <MenuItem Name="SubPage 2" Url="~/subpage2.aspx">
            <MenuItem Name="ThirdLevel 1" Url="~/thirdlevel1.aspx" />
            <MenuItem Name="ThirdLevel 2" Url="~/thirdlevel2.aspx" />
            <MenuItem Name="ThirdLevel 3" Url="~/thirdlevel3.aspx" />
        </MenuItem>
        <MenuItem Name="SubPage 3" Url="~/subpage3.aspx" />
    </MenuItem>
    <MenuItem Name="Page 3" Url="~/page3.aspx" />
</Menu>

And a recusive function to loop all this out to an <ul> menu like this:

// ^^^ loaded all into an XmlNodeList
private void CreateMenuItems(HtmlTextWriter writer, XmlNodeList menuitems)
{
    writer.RenderBeginTag(HtmlTextWriterTag.Ul);
    foreach (XmlNode item in menuitems)
    {
            writer.RenderBeginTag(HtmlTextWriterTag.Li);
            writer.AddAttribute(HtmlTextWriterAttribute.Href, this.ResolveUrl(item.Attributes["Url"].Value));
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.Write(item.Attributes["Name"].Value);
            writer.RenderEndTag();
            if (item.HasChildNodes)
            {
                // Recusive funktion
                CreateMenuItems(writer, item.ChildNodes);
            }
            writer.RenderEndTag();
    }
    writer.RenderEndTag();
}

All this works very fine and it lists all in a tree-menu like structure.

This is good when I want to create an DropDown menu. But since I want the subpages in a sidebar I need to make a new web control that lists the current page structure based on the upper parent.

So if I am on “Page 2” I want an control to get the items in “Page 2”-ChildNodes. And if I click the “SubPage 2” I want it to list all from the upper parent “Page 2” like:

Page 1
Page 2 *click*
------------ SUB MENU I WANT TO LIST -------------
 --> SubPage 1
 --> SubPage 2 *click*
    --> ThirdLevel 1
    --> ThirdLevel 2
    --> Third Level 3 *current page*
  --> SubPage 3
------------ SUB MENU I WANT TO LIST -------------
Page 3

I am aware I need to detect the current url, finding the XmlNode and go back. But I am unsure how to navigate on that level. :-/

  • 1 1 Answer
  • 0 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. Editorial Team
    Editorial Team
    2026-05-25T10:02:12+00:00Added an answer on May 25, 2026 at 10:02 am

    Have you considered using the built in sitemap functionality? FindSiteMapNodeFromKey

    No sense handling a bunch of xml if you don’t have to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have sitemap which looks like this: <?xml version=1.0 encoding=utf-8 ?> <siteMap xmlns=http://schemas.microsoft.com/AspNet/SiteMap-File-1.0 >
I have this sitemap: <?xml version=1.0 encoding=utf-8 ?> <siteMap xmlns=http://schemas.microsoft.com/AspNet/SiteMap-File-1.0> <siteMapNode> <siteMapNode url=www.google.com title=Google
So I have xml that looks like this: <todo-list> <id type=integer>#{id}</id> <name>#{name}</name> <description>#{description}</description> <project-id
I have XML with a value like the following: <products> <product id=1 name=All Products>
I have two XML file sitemap.xml and mouse.xml which look like below.Here the thing
Below is the XML schema I am trying to conform to: <?xml version=1.0 encoding=UTF-8?>
I have an XML structure like the following: <Page Depth=1> <Page Title=Communities Depth=2> <Page
I am trying to use JQuery to parse a sitemap.xml to look like this
I have XML-request from web service. It looks like this. So, how can I
I have an xml sitemap structured like a document tree, such that it looks

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.