I was asked to look into an issue on a SharePoint 2010 site that my users had been working with regarding strange behaviour with the navigation controls in various lists that they had created. This post describes a bug (or feature, take your pick!) where the list view selector control in the title area of a page disappears if there are multiple web parts on the page. First for a bit of background information.
SharePoint 2010 has an updated look and feel from previous versions. For the most part this is a fantastic update that I’ve seen many users find a welcome change. The biggest hurdle is more often than not related to how familiar or open users are to the introduction of the ribbon into SharePoint.
By introducing the ribbon, which contextually changes dependent upon the content being viewed, some modification was required to the how navigation is presented in a SharePoint site – hence the browse tab on the ribbon. The browse tab shows the site title and site logo, plus it now also shows the site path. The starting node of the site path is dependent upon the individual navigation settings of a site.
By showing the site path in the title area we now have a breadcrumb that the user can access. What about the sites that are choosing not to show the full path, or for situations where the title area is hidden (because it is in the browse tab of the ribbon!)? Well, there is a new breadcrumb control that is shown as a ‘pop-up’ by clicking the little folder icon at the top of the page.
List View Navigation
With the introduction of the ribbon and the replacement of the list toolbar (see my previous post on how to show the list toolbar in 2010) it is now potentially harder to navigate between list views. The ability to do so is available in the List tab of the ribbon, but we are seemingly introducing an additional number of clicks to get there than was required in 2007.
In order to make the navigation between views easy the title area breadcrumb that we mentioned earlier has a great feature where, when you are viewing a list, the last node of the breadcrumb becomes a List View Selector.
It is with this list view selector control that my users had reported the strange behaviour of it being present on some lists and not on others. After a little bit of investigation it became clear that the deciding factor in if the list view selector was shown was if the users had edited the list view page (not the view itself) and added any additional web parts – a perfectly valid thing to do in SharePoint 2010. After they had added a web part to the view then the list view selector disappeared to be replaced by a much less functional breadcrumb:
Unfortunately after discovering this, and digging deeper as to why it happens, the conclusion is that this is out of the box functionality and it is currently not possible to have the list view selector control on a list view page with more than one web part.
After seeing the behaviour described above I dug a little deeper into trying to discover why this happened, with the hope of being able to overcome it. Looking at a list view page in SharePoint Designer I could see that the list view control was specific to the page used to generate the list view, i.e. the PlaceHolderPageTitleInTitleArea placeholder was being overwritten to display a control called ListTitleViewSelectorMenu as shown by this code excerpt:
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server"> <SharePoint:ListProperty Property="TitleBreadcrumb" runat="server"/> <SharePoint:UIVersionedContent UIVersion="4" runat="server"> <ContentTemplate> <span class="ms-ltviewselectormenuheader" runat="server"> <SharePoint:ListTitleViewSelectorMenu AlignToParent="true" id="LTViewSelectorMenu" runat="server" /> </span> </ContentTemplate> </SharePoint:UIVersionedContent> </asp:Content>
Wanting to investigate further I got a quick lesson in using Reflector from my colleague Stuart Starrs (@starznet) and took a look at the ListTitleViewSelectorMenu in more detail. As you can see from the screenshot there is actually a hard-code check to only show the control if it is the only web part on the page!
I can’t actually think of a scenario where this would be desirable, but the check has been deliberately put in there so I assume there must be a good reason for it! Unfortunately this leaves us with the poor choice of having the list view selector or having multiple web parts on the page – not both.