I am trying to figure out how to create a menu that displays the top level children of the root. The one requirement is that if you are on a child page, whatever node that page is contained under should not show.
My site is structured:
- Root
- Section 1
- S1 child page 1
- S1 child page 2
- S1 child page 3
- S1 child page 5
- Section 2
- S2 child page 1
- s2 child page 2
- S2 child page 4
- Section 3
- S3 child page 1
- S3 child page 2
- S3 child page 3
- S3 child page 5
- Section 4
- S4 child page 1
- S4 child page 2
- S4 child page 3
- S4 child page 5
I am currently using a DDR Menu designed with a Razor Template. I easily create a menu that displays the children of the root. Using the structure above the menu contains Section 1, Section 2, Section 3, Section 4. http://www.dnnsoftware.com/wiki/page/ddrmenu-razor-templates is the basic example I started with.
The difficulty I am having is figuring out how to hide the current section. If I am on the page, Section1.aspx, I can check the node.Selected property and choose not to print the item "Section 1". I can traverse the node structure and determine if any children are selected. The problem is with pages that are not represented in the menu. Say the user is on the page "S4 child page 4". As you can see in the structure above, it is not part of the menu so a traversal of child nodes would not find the selected item.
I could create a separate Razor template for each section that ignores itself but I would rather have one template that can be used for all sections for easier maintenance. Any suggestions?