locked
Custom Navigation in 2010 (Masterpage and TopNavigationMenu). RRS feed

  • Question

  • Hi All,

    I have recently run a migration into a dev environment from wss3 to 2010 foundations. Using the old masterpages the only things which appear to be broken are my custom webparts, workflows and any other bits of code that were deployed to the gac. To be honest, this was exactly as I expected, however when I switch to the new masterpages things are a little different, in wss3 I had changed the masterpage to allow dropdown menus on my top navigation bar this was achieved by a few edits to the default masterpage and navigation provider :ID="TopNavigationMenu" and by changing MaximumDynamicDisplayLevels  as covered in Heather Solomons blog.

    So having switched the masterpage I then edited the same details for the version 4 masterpage with the below:

    	<SharePoint:AspMenu
    	 ID="TopNavigationMenuV4"
    	 Runat="server"
    	 EnableViewState="false"
    	 DataSourceID="topSiteMap"
    	 AccessKey="<%$Resources:wss,navigation_accesskey%>"
    	 UseSimpleRendering="true"
    	 UseSeparateCss="false"
    	 Orientation="Horizontal"
    	 StaticDisplayLevels="2"
    	 MaximumDynamicDisplayLevels="2"
    	 SkipLinkText=""
    	 CssClass="s4-tn"/>
    	<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
    		<Template_Controls>
    			<asp:SiteMapDataSource
    			 ShowStartingNode="False"
    			 SiteMapProvider="SPNavigationProvider"
    			 id="topSiteMap"
    			 runat="server"
    			 StartingNodeUrl="sid:1002"/>
    		</Template_Controls>
    

    Fully expecting to get the same navigation with the new basic sharepoint theme I saved the masterpage and took a look. That was at 10am uk time, after a full day looking over it and possible other methods I am still very much at a dead end. Below are links to screenshots showing part of the same content and navigation with the different masterpages:

    WSS3: navigation 2010 Foundations navigations

    I would appreciate if anbody point me in the right direction of how I might achieve similar navigation in 2010 foundations? 

    Thanks in advance,

    Vince.

     

     

    Wednesday, November 3, 2010 7:04 PM

Answers

  • Hi Vince,

    Status Update: I dont do as much work, lol with WSS3 or now Foundation and was not aware of this issue. The ability to modify the MasterPage to enable Flyouts by changing the value in MaximumDynamicDisplayLevels="1" to 2 or 3 is something I took for granted and assumed the Navigation would not be restricted in Foundation. However, I am now ramping up a server to repro the issue. However, testing and research will probably not be complete until Monday or Tuesday as I have time to do so..

     

    Cheers,

    -Ivan

     


    Ivan Sanders My LinkedIn Profile, My Blog, @iasanders.
    • Marked as answer by Wayne Fan Friday, November 12, 2010 2:38 AM
    Friday, November 5, 2010 9:04 AM
  • Sure thing! This snippet adds a menu item under the Home node (the first node in the TopNavigationBar).

    SPNavigationNode home =
        web.Navigation.TopNavigationBar[0];
               
    home.Children.AddAsFirst(
        new SPNavigationNode("Tasks", "/Lists/Tasks"));

    This one adds a menu for the Links list as the last node of the top bar.

    SPSite site = new SPSite(@"http://spf2010");
        SPWeb web = site.RootWeb;

        SPNavigationNodeCollection topBar =
            web.Navigation.TopNavigationBar;
        topBar.AddAsLast(new SPNavigationNode("Links",
            "/Lists/Links"));

    Hope this helps,

    --Doug

    • Marked as answer by Wayne Fan Friday, November 12, 2010 2:38 AM
    Friday, November 5, 2010 2:00 PM

All replies

  • Hi,

    Just to be safe and ensure we are in the same page, have yoiu tested whether your V4 master page is in use? The only issue I see is that you have only set the MaximumDynamicDisplayLevels="2" where in your SP2007 image I think its set to 3, Since using SharePoint Foundation you will not have the publishing infrastructure have yoiu set your master page to default master or custom master?

    -Ivan


    Ivan Sanders My LinkedIn Profile, My Blog, @iasanders.
    Wednesday, November 3, 2010 7:50 PM
  • Hi Ivan,

    I have been switching between the v3 and v4 master pages in designer, the screens above are identicle content but with the different masterpage applied, so I am confident that the v4 masterpage is in use. I have changed maximum dynamic levels to 3 and there is still no second level links or any sort of dropdown.

    I am also setting the masterpage as default master.

    Vince

    Wednesday, November 3, 2010 8:12 PM
  • Hi Vince,

    Under Site Settings  > Navigation Settings ensure  all sites and sub sites have Show subsites and Display the same navigation items as the parent site?

     

    -Ivan


    Ivan Sanders My LinkedIn Profile, My Blog, @iasanders.
    Wednesday, November 3, 2010 8:23 PM
  • Hi Ivan,

    I have had a look in site settings and can't see any options for navigation, below is a screenshot of my site settings in wss4:

    2010 Foundation site settings.

    The only thing that resembles anything to do with navigation is "top link bar" under look and feel. But that is void of anything appart from telling me that they are inheriting links.

    Vince

    Wednesday, November 3, 2010 8:35 PM
  • I am still looking for a solutions for this. I really would like to use the new masterpage for the clean look and feel in 2010 foundations but without the navigation im very much stuck, any further help would be greatly appreciated.

    Thursday, November 4, 2010 10:57 AM
  • Hi Vince,

    Top link bar is the correct settings page for a Team site. Ivan is referring to the navigation settings page for a Publishing site. Assuming you are using SharePoint Server and have the option, Publishing features are needed here because the Team site navigation settings UI has no support for heirarchical menu structures in 2010.

    If you enble the Publishing Infrastructure site collection feature in your top level site and the Publishing feature in your top level site and your subsites, you will see the Navigation Settings page to which Ivan refers and have the ability to specify tiered menus. Without turning on publishing it can still be done, but you must use the object model from code to add the menu items.

    Hope this helps,

    --Doug

    Thursday, November 4, 2010 12:15 PM
  • Hi Doug,

    Unfortunatly we are using Foundations so we don't have the availability of the publishing feature. I am semi familiar with the objust model but in all honesty I am normally much better placed with "business process" coding of workflows and event handlers etc rather than making changes to the look and feel.

    I would very much like some guidance on the using the object model to add the menu items if this is somthing that you have any experience with. Thanks in advance.

    Vince. 

    Thursday, November 4, 2010 12:28 PM
  • Hi Vince,

    Status Update: I dont do as much work, lol with WSS3 or now Foundation and was not aware of this issue. The ability to modify the MasterPage to enable Flyouts by changing the value in MaximumDynamicDisplayLevels="1" to 2 or 3 is something I took for granted and assumed the Navigation would not be restricted in Foundation. However, I am now ramping up a server to repro the issue. However, testing and research will probably not be complete until Monday or Tuesday as I have time to do so..

     

    Cheers,

    -Ivan

     


    Ivan Sanders My LinkedIn Profile, My Blog, @iasanders.
    • Marked as answer by Wayne Fan Friday, November 12, 2010 2:38 AM
    Friday, November 5, 2010 9:04 AM
  • Sure thing! This snippet adds a menu item under the Home node (the first node in the TopNavigationBar).

    SPNavigationNode home =
        web.Navigation.TopNavigationBar[0];
               
    home.Children.AddAsFirst(
        new SPNavigationNode("Tasks", "/Lists/Tasks"));

    This one adds a menu for the Links list as the last node of the top bar.

    SPSite site = new SPSite(@"http://spf2010");
        SPWeb web = site.RootWeb;

        SPNavigationNodeCollection topBar =
            web.Navigation.TopNavigationBar;
        topBar.AddAsLast(new SPNavigationNode("Links",
            "/Lists/Links"));

    Hope this helps,

    --Doug

    • Marked as answer by Wayne Fan Friday, November 12, 2010 2:38 AM
    Friday, November 5, 2010 2:00 PM
  • Any word on the WSS issue Ivan?

    I've upgraded from WSS 3.0 to SharePoint Enterprise and I don't get the Dynamic fly-outs (beyond 2 levels deep). It's not feasible to enable the Publishing Feature and create pages on each and every sub-site.

    Thursday, January 6, 2011 6:27 AM
  • Hi Peter,

    If you are using SharePoint not WSS3, then you can have drop down flyouts to as many as you want though I have never attempted more than 4, and 2-3 is probabaly all you should do. Enabling the publishing feature doesnt mean you create any more pages it allows you to share inherit masterpages and a lot of other stuff that makes branding much easier.. However, you dont get dynamic flyouts by default you need to modify the MaximumDynamicDisplayLevels="3" You should also just so you understand how it works change the StaticDisplayLevels="2" to 1 or 3 just for fun...

     Example TopNavigation

    	<SharePoint:AspMenu
    	 ID="TopNavigationMenu"
    	 Runat="server"
    	 DataSourceID="topSiteMap"
    	 EnableViewState="false"
    	 AccessKey="<%$Resources:wss,navigation_accesskey%>"
    	 Orientation="Horizontal"
    	 StaticDisplayLevels="2"
    	 <strong>MaximumDynamicDisplayLevels="3"</strong>
    	 DynamicHorizontalOffset="0"
    	 StaticPopoutImageUrl="/_layouts/images/menudark.gif"
    	 StaticPopoutImageTextFormatString=""
    	 DynamicHoverStyle-BackColor="#CBE3F0"
    	 SkipLinkText=""
    	 StaticSubMenuIndent="0"
    	 CssClass="ms-topNavContainer">
    		<StaticMenuStyle/>
    		<StaticMenuItemStyle CssClass="ms-topnav" ItemSpacing="0px"/>
    		<StaticSelectedStyle CssClass="ms-topnavselected" />
    		<StaticHoverStyle CssClass="ms-topNavHover" />
    		<DynamicMenuStyle BackColor="#F2F3F4" BorderColor="#A7B4CE" BorderWidth="1px"/>
    		<DynamicMenuItemStyle CssClass="ms-topNavFlyOuts"/>
    		<DynamicHoverStyle CssClass="ms-topNavFlyOutsHover"/>
    		<DynamicSelectedStyle CssClass="ms-topNavFlyOutsSelected"/>
    	</SharePoint:AspMenu>
    

     

     -Ivan

     What have you done for the love of SharePoint?


    Ivan Sanders My LinkedIn Profile, My Blog, @iasanders.
    Thursday, January 6, 2011 6:58 AM
  • Thanks for your time Ivan.

    I've got it to work - turns out the Master Page wasn't being applied. SharePoint reported it to be "v4_custom.master" (the copy I made and modified), however SharePoint Manager 2010 still reported it as "v4.master" (including for all subsites). So despite the recommendations, I've modified the original v4.master short of any other options.

    Thursday, January 6, 2011 8:03 AM
  • No Worries,

    There shouldnt have been an issue unless you were creating Team Sites and didnt change the Default Master to be your v4.Custom.Master?

    Set a different master page as the default master page    When you set a new master page as the default master page, the new master page is then applied to every page in your site that is attached to the default master. http://office.microsoft.com/en-us/sharepoint-designer-help/change-the-current-master-page-HA010167165.aspx

    1. In the Folder List, in the _catalogs folder, open the masterpage folder.  If the masterpage heading is collapsed, click the plus sign (+) to expand it.
    2. In the masterpage folder, right-click the master page that you want to use as the new default master, and then click Set as Default Master Page on the shortcut menu.

     

    -Ivan


    Ivan Sanders My LinkedIn Profile, My Blog, @iasanders.
    Thursday, January 6, 2011 8:53 AM
  • Of course thanks Ivan, even an upgraded WSS site would ignore the Master Page setting from the Browser UI (it needs to inherit from the Publishing Page class or something like that). I suppose in WSS I'm just used to installing the Master Page selector feature from codeplex if the menu option doesn't exist (which modifies the underlying MasterUrl property).

    Just throwing it out there - strange that you have to unghost the master page just to get an extra level of menu depth?

    Thursday, January 6, 2011 11:30 PM
  • Hi Peter,

    Y9ou wouldnt unghost a master Page, after you have the master Page modifications made to your sopecifications you would save the master page to the file system and craetea provisioning featutre to deploy the master page to the masterpage gallery..

     

    Example module to deploy master pages of element manifest

     <Module Name="PFMasterPages" Url="_catalogs/masterpage" Path="MasterPages" RootWebOnly="TRUE">
      <File Url="allergan-beacon.master" Type="GhostableInLibrary">
       <Property Name="MasterPageDescription" Value="" />
       <Property Name="ContentType" Value="Page Layout" />
       <Property Name="PublishingPreviewImage" Value="," />
      </File>
      <File Url="Beacon.master" Type="GhostableInLibrary">
       <Property Name="MasterPageDescription" Value="" />
       <Property Name="ContentType" Value="Page Layout" />
       <Property Name="PublishingPreviewImage" Value="," />
      </File>
     </Module>
    

    Example Module to deploy page layouts

     <Module Name="PFPageLayouts" Url="_catalogs/masterpage" Path="PageLayouts" RootWebOnly="TRUE">
      <File Url="allergan-beacon-metastormtab.aspx" Type="GhostableInLibrary">
       <Property Name="Title" Value="" />
       <Property Name="MasterPageDescription" Value="" />
       <Property Name="ContentType" Value="Page Layout" />
       <Property Name="PublishingPreviewImage" Value="," />
       <Property Name="PublishingAssociatedContentType" Value=";#Page;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39;#" />
      </File>
      <File Url="allergan-beacon-1col.aspx" Type="GhostableInLibrary">
       <Property Name="Title" Value="" />
       <Property Name="MasterPageDescription" Value="" />
       <Property Name="ContentType" Value="Page Layout" />
       <Property Name="PublishingPreviewImage" Value="," />
       <Property Name="PublishingAssociatedContentType" Value=";#Page;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39;#" />
      </File>
     </Module>
    

     

    I agree with using the codeplex feature but again I havent done much WSS branding just look at my site and you can tell...

     

    Cheers,

    -Ivan 


    Ivan Sanders My LinkedIn Profile, My Blog, @iasanders.
    Thursday, January 6, 2011 11:57 PM
  • Ivan and Peter,
                      I have also upgraded my WSS to Sharepoint Foundation 2010 but i haven;t got the flyout menu to work.
    I have changed both the MaximumDynamicDisplayLevels="3"  and the the StaticDisplayLevels="2"
    but still no luck.

    Any ideas. My masterpages read v4.master,default.master and mnimal master.
    default.master is the olde master page from my WSS v3 sites.

    I have been changing  the new one v4.master with no luck

    Thanks in Advance

    Monday, January 24, 2011 4:18 AM
  • Hi Patrick, I upgraded to SharePoint Server (not Foundation) but just make sure that you're using the right Master Page. Also make sure it's checked-in and published (not sure if you have to in Foundation).

    You can use SharePoint Manager 2010 tool from CodePlex to check the "MasterUrl" property or you can use this PowerShell:

    $w = Get-SPWeb http://URL
    $w.MasterUrl


    I had to write a script to set the MasterUrl for all subsites to the root v4.master page (as they were using their own master page for each site). I also - for SharePoint Server - had to tell it to "Show Subsites":

    Example to set v4.master at parent site:

    $s = Get-SPSite http://server
    $webs = $s.AllWebs

    foreach ($w in $webs)

      $w.MasterUrl = "/_catalogs/masterpage/v4.master";
      $w.Update
    ();

    }

    Example to "Show Subsites" - likely only applies to SharePoint Server (and not Foundation):

    $s = Get-SPSite http://server
    $webs = $s.AllWebs

    foreach ($w in $webs)

      $pubweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($w);
      $pubweb.IncludeSubSitesInNavigation = $True;

      $pubweb.Update();

    }


    Monday, January 24, 2011 4:28 AM
  • Thanks Peter for the quick response.
    I hope i can get the same result for foundation but it seems its going to be tough.No ideas why it changed its used to be sooo easy with WSS v3.:(

    1)I don't have anything like publishing in Sharepoint Foundation - Anyone correct me if i'm wrong
    2)I'm sure the sites i migrated are using v4.master as their master pages
    3)There is no options to SHOW SUBSITES in foundation - anyone correct me if i'm wrong
    4)In sharepoint designer the masterpagefile shows ~masterurl/custom.master is this file the same as v4.master?

    Hope i get this to work on foundation as actually not fun as WSS v3 navigations was better.
    Will post anything if i get it to work.
    Let me read from all

     

    Monday, January 24, 2011 5:24 AM
  • 1. No you won't have Publishing in Foundation.
    2. Best to check the MasterUrl property though as per above.
    3. No, again, this is releated to Publishing. I'm guessing that the menu Data Source in WSS/Foundation should include all sites by default. Unless I'm mistaken.
    4. Custom.master is a special case I think... can't be sure, but try right-clicking on your v4.master and see if there's a setting like "set as custom master".

     

    Monday, January 24, 2011 5:41 AM
  • Yes Peter there is set as custom master when i higlight v4.master and you look at the menu and i did set it BUT broke the site


    4. Custom.master is a special case I think... can't be sure, but try right-clicking on your v4.master and see if there's a setting like "set as custom master".

     

    Monday, January 24, 2011 6:19 AM
  • Does anybody solved this Flying menus for SharePoint Foundation?

    I did change the actual master page for the site (ID="TopNavigationMenu", changing MaximumDynamicDisplayLevels), did the restart of IIS.

    It still doesnt work. Has this feature been completely disabled from Foundation version?

    I am still looking for the answer, reading all the blogs, forums etc for past couple of hours...

     

    Monday, March 28, 2011 9:29 AM
  • Hello Doug,

    I'm trying to use the SharePoint AspMenu control to connect to a SharePoint lists.  Your code above looks like just what i need.  Where do i put it?

    Thanks,
    Hyde


    There is nothing more difficult to take in hand, more perilous to conduct or more uncertain in its success than to take the lead in the introduction of a new order of things.

    Tuesday, February 28, 2012 9:57 PM