Search code examples
sharepoint-2010navigationquicklaunch

SharePoint 2010: Quick Launch Navigation Levels


Can someone tell me how to configure the OOTB AspMenu control to achieve the following:

  • The quick launch should only show 1 level of static items
  • Except for headings, these are meaningless on their own so the pages/links beneath them should also be displayed
  • The menu should not display an dynamic flyouts

Essentially, the navigation menu should appear as follows (assume that the subsites both have child sites and/or pages but which should be hidden):

Starting Node 
- Subsite1
- Subsite2
- Page1  
- Heading
  - Page2
  - Page3

Solution

  • I couldn't find a way to achieve this functionality using the properties of the AspMenu control, so instead I just explicitly removed and subsite's child items in the MenuItemDataBoundEvent as follows:

    protected void CurrentNavigationMenu_MenuItemDataBound(object sender, MenuEventArgs e)
    {
        // Hide the contents of subsites (only level-1 links beneath headings are displayed).
        if (e.Item.Parent != null && e.Item.Parent.Selectable)
            e.Item.Parent.ChildItems.Remove(e.Item);
    }