1
votes

I wish to generate an A-Z from a SiteMap... I do not use the Web.SiteMap directly, rather a StaticSiteMapProvider, based on this blog post by Simon Harriyott: Adding dynamic nodes to ASP.NET site maps at runtime by deriving from StaticSiteMapProvider

How can I go about doing this?

Edit:

I want an A-Z list, by link title. Could be starting at the root node or any child node. I also want to bind to a repeater and limit which pages to show (for example, don't show links with 'admin' or 'profile' in the URL).

Using .NET 2.0, so no LINQ code.

1
You want alphabetized pages rather than chronologically ordered? - Soviut
Yes... can't really order by time unless using a database to build it dynamically (wouldn't know how to start on that - e.g. date updated attached to each node...) - SamWM
It's nice to know that you're using my code - harriyott

1 Answers

0
votes

I'm not exactly sure what you mean by an "A-Z". I think what you mean is you want an alphabetized list of all pages in your SiteMap? If so then this might help.

        var NodesAtoZ = from SiteMapNode node in SiteMap.RootNode.GetAllNodes()
                    orderby node.Title
                    select new
                    {
                        Title = node.Title,
                        Url = node.Url,
                        Description = node.Description
                    };

This returns a list of all SiteMap nodes ordered by Title.