Try Now
More in this section

Forums / General Discussions / how to get all sitemap node

how to get all sitemap node

3 posts, 0 answered
  1. Nauman
    Nauman avatar
    35 posts
    28 Jul 2008
    02 Mar 2010
    Link to this post
    Hi Sitefinity Guys

    I need to get all the sitemap nodes both show  Show in navigation is true and false

    I tried this way explained in form thread

    <siteMap defaultProvider="CmsSiteMapProvider" enabled="true">
    <add name="CmsSiteMapProvider" description="Displays Cms Pages" type="Telerik.Cms.Web.CmsSiteMapProvider"/>
    <add name="AllPages" navigable="false" type="Telerik.Cms.Web.CmsSiteMapProvider"/>

    but it's not working at all.

    I know  i can use CmsManager().GetPage() etc to get pages, but i need to populate the page nodes in the CmsSiteMapProvider

    Please help
    Nauman Ahmed
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    01 Feb 2016
    02 Mar 2010
    Link to this post
    Hi Nauman,

    Thank you for using our services.

    You could try to create a custom CmsSiteMapProvider and override the method which gets nodes, sample bellow:
    using System;
    using System.Collections.Generic;
    using System.Web;
    using Telerik.Cms.Web;
    namespace Sitefinity.Samples
        /// <summary>
        /// Summary description for CustomCmsSiteMapProvider
        /// </summary>
        public class CustomCmsSiteMapProvider : CmsSiteMapProvider
            public override SiteMapNodeCollection GetChildNodes(SiteMapNode parentNode, SiteMapDisplayMode displayMode)
                if (parentNode == null)
                    throw new ArgumentNullException("node");
                IList<SiteMapNode> list = this.BuildChildNodes(parentNode);
                if ((list == null) || (list.Count == 0))
                    return SiteMapNodeCollection.ReadOnly(new SiteMapNodeCollection());
                HttpContext current = HttpContext.Current;
                SiteMapNodeCollection collection = new SiteMapNodeCollection(list.Count);
                foreach (SiteMapNode node in list)
                    CmsSiteMapNode node2 = node as CmsSiteMapNode;
                    if (node.IsAccessibleToUser(HttpContext.Current))
                return SiteMapNodeCollection.ReadOnly(collection);

    Then add it to the sitemap providers collection:
    <siteMap defaultProvider="CmsSiteMapProvider" enabled="true">
            <clear />
            <add name="CmsSiteMapProvider" description="Displays Cms Pages" type="Telerik.Cms.Web.CmsSiteMapProvider" />
    <add name="AllPages" navigable="false" description="Dislplays All Cms Pages" type="Sitefinity.Samples.CustomCmsSiteMapProvider, App_Code"/>

    Then if you instantiate a SiteMap with this AllPages provider you will get all pages.

    Kind regards,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Abhisheq
    Abhisheq avatar
    2 posts
    12 Jan 2011
    23 Feb 2011
    Link to this post
    Hello telerik team,

    I did as per provided suggestion and tried to implement it in another page with a usercontrol  using RadTreeview  control but I am not finding the way how to bind this control.
    <telerik:RadTreeview ID="SiteMapRadTreeView" runat="server"  >
Register for webinar
3 posts, 0 answered