Take the 2-minute tour ×

I am trying to create a Top Nav Bar for SP Foundation that uses dropdowns/flyouts and is dynamically populated from a SharePoint list. This will allow the site admin to modify the navigation without going into a sitemap or xml file. Has anyone done this before or know where to direct me for this?

share|improve this question

2 Answers 2

I've done this before but it gets a little complicated. You have a few options but they all start with a masterpage change. You need to take the current navigation in your masterpage and put it into a user control and in it's place in the masterpage, put in a delegate control that defaults to the user control you just created. Doing this allows you to create additional user controls and using features, you can swap in and out which control is rendering the top navigation.

Option 1: Create a webpart or web control that looks like the top navigation and reads the data from a list (a Links list work's pretty well). Add this webpart or web control to a user control and create a feature that swaps it out in the masterpage. The hard part of this is getting your HTML output to match the normal top navigation.

Option 2: Create a sitemapprovider that reads from a list (again links list work's well). Then you can just copy the user control you created earlier (and of course write a feature to enable your user control), but where it uses the default sitemapprovider, put in the name of yours. Also be sure to add your sitemapprovider to the web.config. The rendering is easy on this one because you are using the same control that SP uses, just changing the data it uses. The hard part of this is the concurrency issues of a sitemapprovider. SiteMapProviders are stored in the application cache so any local variables you have will be available between requests (like a static class/variable). You will need to be able to handle concurrency quickly and effectively (not just using LOCK everywhere) because all of your requests are now using your code and many times you will be serving many requests at the same time. I would suggest some local caching model instead of reading from the list every time and some way for your cache to invalidate when the list changes.

share|improve this answer

I'm wondering what is wrong with regularr navigation, e.g. top-level site publishing but subsequent sub-sites could be regular collaboration sites. Site Admins could use the Settings > Navigation and add Heading plus Links.

In addition to Steve's notes, for the option 1 i've succesfully used and styled (but than you need to consider reusability across pages) and then again it doesn't work for multiple site collections (without updates) is available at https://www.nothingbutsharepoint.com/sites/eusp/pages/a-megamenu-for-sharepoint-2010-using-a-dvwp-and-a-list.aspx or http://cube4.com.au/?p=334

share|improve this answer

Your Answer


