I've been asked to create an asp.net UserControl that allows custom navigation between subsites of a SharePoint 2007 website. The sites mimics a school structure with semesters that have different groups of classes. Here is a simplified version of the site structure:
Site Root
Search
Semester1
Class Group 1
Class 1
Page1.aspx
Page2.aspx
Class 2
Page1.aspx
Page2.aspx
Class Group 2
Class 3
Page1.aspx
Page2.aspx
Class 4
Page1.aspx
Page2.aspx
Semester2
Class Group 1
Class 1
Page1.aspx
Page2.aspx
Class 2
Page1.aspx
Page2.aspx
Class Group 2
Class 3
Page1.aspx
Page2.aspx
Class 4
Page1.aspx
Page2.aspx
Some Other Subsites
The UserControl will be placed on the classes' .aspx pages. It's purpose is to allow a user to navigate to identical pages between the different Class Groups.
E.G. Let's say I'm on Semester1/Class Group 1/Class 1/Page2.aspx. The UserControl would allow me to choose any of the other classes under Semester1. When chosen, it would automatically navigate to the [selected class]/Page2.aspx (because I am currently on Page2.aspx).
Before today I have never used a SiteMapProvider. So far I've only managed to programmatically walk through the site structure and print out a simple site map to a page using the default CombinedNavSiteMapProvider PortalSiteMapProvider. What I think I need but am not sure how to do is:
From there, I think I can use the menu events to handle navigation. Example of UserControl's menu if I am on Semester1/Class Group 1/Class 1/Page2.aspx:
Change Class
Class Group 1
Class 1
Class 2
Class Group 2
Class 3
Class 4
How can I accomplish the bulleted item above?
I didn't find anything elegant. I ended up binding an asp.net menu to the CombinedNavSiteMapProvider then in the DataBound event handler, I modify the menu items in code. I insert a root "Change Class" item, then use a little recursive method to set IsSelectable to false for any menu items that have children.