2

In the quicklaunch navigation, we've added a menu item for each view from a specific list.

Listname

  • View 1
  • View 2
  • View 3

The breadcrumb only displays the path down to the list; Root > Sub > Listname.
What the costumer wants is for the breadcrumb to display this path; Root > Sub > Listname > View title.

Is this possible with minor tweaking of OOTB SharePoint or will we have to generate our own sitemap provider in order to achieve this?

2 Answers 2

2

I had a free time to play with your issue, the easest way that I found is to use MenuItemDataBound event.

protected void Page_Load(object sender, EventArgs e)
{
    V4QuickLaunchMenu.MenuItemDataBound += V4QuickLaunchMenu_MenuItemDataBound;
}

private void V4QuickLaunchMenu_MenuItemDataBound(object sender, MenuEventArgs e)
{
    PortalSiteMapNode node = (PortalSiteMapNode)e.Item.DataItem;
    if (node.Type == NodeTypes.AuthoredLinkPlain)
    {
        SPList list = SPContext.Current.Web.GetList(node.Url);
        foreach (SPView view in list.Views)
        {
            MenuItem item = new MenuItem(view.Title);
            item.NavigateUrl = view.Url;
            e.Item.ChildItems.Add(item);
        }
    }
}

also as I told before you should change StaticDisplayLevels of aspmenu from 2 to 3.

1

if you use publishing feature, you can manage what navgation links are hidden, what navigation links can be shown for curent user. It is difficult to implement in your custom provider. In this case you can try to get navigation nodes from default publishing provider. This provider is called PortalSiteMapProvider.

In web configuration you can finde its declaration

<add name="CurrentNavigation" description="Provider for MOSS Current Navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" Version="14" />

In your code you can retrieve nodes for current location like this

ProviderSettings settings = new ProviderSettings("GlobalNavSiteMapProvider", "Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c");
settings.Parameters["NavigationType"] = PortalNavigationType.Current.ToString();
settings.Parameters["EncodeOutput"] = "true";
settings.Parameters["Version"] = "14";

PortalSiteMapProvider provider = (PortalSiteMapProvider)ProvidersHelper.InstantiateProvider(settings, typeof(PortalSiteMapProvider));
PortalSiteMapNode currentNode = (PortalSiteMapNode)provider.CurrentNode;
var nodes;

if (currentNode != null)
{
    nodes = currentNode.GetNavigationChildren(NodeTypes.Default, NodeTypes.Default, OrderingMethod.Manual, AutomaticSortingMethod.Title, true, -1);
}

Then you can go through this nodes and check node type. if node.Type & NodeTypes.List you can retrieve this list by node url, retrieves views url for this list and add new nodes to current list node.

Then you can bind this node collection to the sharepoint asp menu.

Also you should keep in mind that sharepoint menu is configured to display only 2 levels by default. So you should modify its markup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.