Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reading and loop in web.sitemap in C#

Posted on 2010-09-17
2
Medium Priority
?
1,641 Views
Last Modified: 2012-06-21
Hi,

I am working in ASP.net using c#

I have generated menu and navgation  using web.sitemap

How do I loop to web.sitemap programtically and get the values of each attrbutes and tag values

Please help

Many Thanks
0
Comment
Question by:tia_kamakshi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 total points
ID: 33707996
A simple recursive loop should do the trick:

 
        protected void Page_Load(object sender, EventArgs e)
        {
            SiteMapNode rootNode = SiteMap.RootNode;
            ProcessNode(rootNode);

        }

        private void ProcessNode(SiteMapNode parentNode)
        {
            Response.Write(parentNode.Url + " (" + parentNode.Title + ")<br />");

            if (parentNode.HasChildNodes)
                foreach (SiteMapNode node in parentNode.ChildNodes)
                    ProcessNode(node);
        }

Open in new window

0
 

Author Closing Comment

by:tia_kamakshi
ID: 33735285
Many Thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question