1

I want to have a sitemap based on the Managed Metadata where it shows the current node and the full path from only this current node to it's root, don't show it's children and shows it's siblings.

I have done all the setup needed that is described in here. The first thing I have done was to create a delegate control that will overwrite the already existent QuickLaunchSiteMap from the master page.

   <Control
        Id="QuickLaunchDataSource"
        ControlAssembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        ControlClass="System.Web.UI.WebControls.SiteMapDataSource"
        Sequence="40" >
        <Property Name="ID">QuickLaunchSiteMap</Property>
        <Property Name="SiteMapProvider">MySiteMapProvider</Property>
        <Property Name="EnableViewState">true</Property>
        <Property Name="StartFromCurrentNode">true</Property>
        <Property Name="ShowStartingNode">true</Property>
        <Property Name="treatstartingnodeascurrent">true</Property>
        <Property Name="SwitchablePropertiesXml">
          <![CDATA[
                <SwitchableProperty SiteMapProvider="MySiteMapProvider" Name="TrimNonCurrentTypes">Heading</SwitchableProperty>
                <SwitchableProperty SiteMapProvider="MySiteMapProvider" Name="StartingNodeOffset">-20</SwitchableProperty>
                <SwitchableProperty SiteMapProvider="MySiteMapProvider" Name="StartFromCurrentNode">true</SwitchableProperty>
                <SwitchableProperty SiteMapProvider="MySiteMapProvider" Name="ShowStartingNode">true</SwitchableProperty>
                <SwitchableProperty SiteMapProvider="MySiteMapProvider" Name="StartingNodeUrl">sid:1002</SwitchableProperty>
            ]]>
        </Property>
      </Control>

The master page has the AspMenu control:

 <!--SPM:<SharePoint:AspMenu
                        id="V4QuickLaunchMenu"
                        runat="server"
                        EnableViewState="false" 
                        DataSourceId="QuickLaunchSiteMap"
                        UseSimpleRendering="false"
                        ItemWrap="true"
                        Orientation="Vertical"
                        StaticDisplayLevels="7"
                        AdjustForShowStartingNode="true"
                        MaximumDynamicDisplayLevels="0"
                        SkipLinkText=""
/>-->

Later I defined my class based on another solution on StackOverflow for making a site map based on managed metadata:

public class MySiteMapProvider : SiteMapProvider
    {

 private string PROVIDERNAME = "GlobalNavigationTaxonomyProvider";

  public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
                 //Never reached in here
  }

  public override SiteMapNode RootNode
        {
            get
            {
                return SiteMap.Providers[PROVIDERNAME].RootNode;
            }
        }

        public override SiteMapNode CurrentNode
        {
            get
            {

                return SiteMap.Providers[PROVIDERNAME].CurrentNode;
            }
        }

}

I believe the main problem is that the method GetChildNodes is never called, and I don't know why.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.