This tutorial shows how to implement TreeView navigation system, which is very powerful yet easy to employ. C# version.

Especially for the larger sites, navigation can get a little messy at times. Fortunately, Visual Studio makes it easier for us to manage navigation and also construct a hierarchical navigation system that lets users transition freely between pages, especially when it comes to making changes to the web site.

Create an XML file containing the site hierarchy, page titles and URLs.

Add a SiteMapDataSource onto your Master Page. Default configuration is set to retrieve the data from Web.sitemap

Also add a TreeView control onto your Master Page, choosing the Data Source of the Site Map. To also add further navigation on each page, which displays where the current page is in the hierarcy, you can add a SiteMapPath control. Again, by default, the SiteMapPath uses the Web.sitemap file for its hierarchy data.

To add an expandable menu system onto the page also, add the Menu control and choose the Data Source.
The Master Page should look something like this:

All content pages should have the ContentPlaceHolders for the Master Page, and look something like this:

Download Source Files