More in this section

Forums / Developing with Sitefinity / Applying Custom SiteMap to TreeView

Applying Custom SiteMap to TreeView

5 posts, 0 answered
  1. Bill
    Bill avatar
    15 posts
    Registered:
    04 Nov 2008
    18 Mar 2009
    Link to this post
    I am trying to build a control that allows the users to pick and choose what pages will be shown in a navigation control.  Lots of pages will use this control and they want each control to be able to have different pages in the nav.  My thoughts on doing this were to use code found in these forums to create a CustomSiteMap and then somehow apply that to a TreeView(with checkboxes) so they could check or uncheck any pages they wanted to have show up.
    Any thoughts on whether or not this is a good idea?  If it is, how do I apply the CustomSiteMap to a TreeView?  If it isn't, what is a better way?
  2. Bill
    Bill avatar
    15 posts
    Registered:
    04 Nov 2008
    18 Mar 2009
    Link to this post
    I also want this CustomSiteMap to include pages even if they weren't originally included in navigation and I seem to be getting only the ones marked include in navigation.
  3. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    20 Mar 2009
    Link to this post
    Hi Bill,

    we are using ASP.NET sitemap feature for our navigation. ASP.NET sitemap caches all nodes for fast access so creating custom sitemap would not be the best approach.

    Preferred way for doing this is to expose the StartingNodeUrl property of the SitemapDataSource in your navigation control. You can find the example of this approach in our SiteMenu control. The control is located in: ~/Sitefinity/UserControls/Navigation35/SiteMenu.ascx

    Look for the following property:
    [Browsable(true)] 
    [Category("Navigation")] 
    public string StartingNodeUrl 
       get 
       { 
          return this.SiteMapDataSource1.StartingNodeUrl; 
       } 
       set 
       { 
          this.SiteMapDataSource1.StartingNodeUrl = value; 
       } 

    You can find out more information about this property on this page:
    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sitemapdatasource.startingnodeurl.aspx

    By doing so, the users will be able to set the starting node of the SitemapDataSource for the given navigational control through Sitefinity control editor and thus you will be able to have different navigation on different pages.

    I hope you find this information helpful. Let us know if there is anything else we can do for you.

    Kind regards,
    Ivan
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. Bill
    Bill avatar
    15 posts
    Registered:
    04 Nov 2008
    20 Mar 2009
    Link to this post
    Thanks Ivan but we are looking to not just include everything under one starting node.  The control we are building would be able to have the properties set such that they could pick and choose any pages under any nodes in the sitemap.
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    24 Mar 2009
    Link to this post
    Hello Bill,

    In this case the Sitemap would not work for you, because it represents hierarchical structure of all pages. Once you bind your control to it, you get all pages.

    What you can do though is one of the following:
    1. Create a user control which has a Control Designer. Then you place a RadTreeView with checkboxes, which is bound to the Sitemap. In the user control, you will have another control which should be bound to the collection of checked items (checkboxes). This way, you will get only the pages the user has selected.

    2. It will be really easier if you place your links in a UL collection in, a Generic Content item. Now that the links are dynamic, they will not be broken even if you move the pages arround the sitemap.

    3. Wait for Sitefinity 4.0. It will have the Taxonomy feature built-in, which will allow you to change/arrange the sitemap in many different ways.

    Regards,
    Georgi
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Register for webinar
5 posts, 0 answered