Solved

Reading and loop in web.sitemap in C#

Posted on 2010-09-17
2
1,579 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 500 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
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…

615 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