Question

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:

  • Get/build a partial site map data structure where root node is the parent Semester of the current page. This can be my own data structure built in code if necessary. I want to bind this to a menu control. Additionally, I'd like the root menu item to have custom text like "Change Class" instead of Semester1.

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top