+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / SiteMap Separator

SiteMap Separator

4 posts, 0 answered
  1. Russell
    Russell avatar
    25 posts
    Registered:
    08 Apr 2009
    26 Oct 2009
    Link to this post
    Hello,

    I am fairly new to Sitefinity and have a question regarding adding a separator image into my menu. I am using the Site Treeview control that uses the SiteMap as its source. I would like to know if there is a way to add a separator between menu items? For Example:

    Item 1
    Item 2
    --------
    Item 3

    Thank you for your help!

    Russell
  2. Mr. Plinko
    Mr. Plinko avatar
    13 posts
    Registered:
    16 Jul 2009
    27 Oct 2009
    Link to this post
    have you seen this link:


    I am confused... are you using the RadMenu or the RadTreeView?

    if RadMenu, you can create items and call them 'IsSeperator = true' like in this post

    if RadTreeView, i am sure there is a better way, but you could create nodes that are dashes and then disable them '.set_enabled(false)'


  3. Russell
    Russell avatar
    25 posts
    Registered:
    08 Apr 2009
    27 Oct 2009
    Link to this post
    Thanks for the reply! I have seen both of those posts, but both of those are adding separators between every menu item. I would like a way to add a separator only between certain items.

    I am using the Site Treeview within Sitefiinity (I believe it extends the RadTreeView). I don't see a way to add a dashed node...when I say that I am using the Site Map as the source that may be a little misleading. The source is the site map that is auto generated from the pages that I have created. So, I believe in order to add a separator there would need to be a separator page. Hope that helps clarify things...thanks for the help!

    Russell
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Nov 2009
    Link to this post
    Hi Russell,

    You can create two public properties - one for specifying the position of the separator and another for specifying the text of the separator. Below is a sample code:

    public void RadTreeview1_NodeBound(object o, RadTreeNodeEventArgs e)
    {
        CmsSiteMapNode navigationNode = e.Node.DataItem as CmsSiteMapNode;
        if (e.Node.Text == SeparatorPage)
        {
     
            RadTreeNode treeNode = new RadTreeNode();
            treeNode.Text = SeparatorText;
            RadTreeview1.Nodes.Add(treeNode);
        }
     
        CmsSiteMapNode currentNode = SiteMap.CurrentNode as CmsSiteMapNode;
        if (currentNode != null && currentNode.ParentNode != null)
        {
            while (currentNode != null && currentNode.ParentNode != SiteMap.RootNode)
            {
                RadTreeNode item2 = this.RadTreeview1.FindNodeByUrl(this.ResolveUrl(currentNode.Url));
                if (item2 != null)
                    item2.Selected = true;
                 
                currentNode = currentNode.ParentNode as CmsSiteMapNode;
            }
        }
    }
     
    [System.ComponentModel.Category("Separator Properties")]
    public string SeparatorPage
    {
        get
        {
            return _separatorPage;
        }
     
        set
        {
            this._separatorPage = value;
        }
    }
     
    [System.ComponentModel.Category("Separator Properties")]
    public string SeparatorText
    {
        get
        {
            return _separatorText;
        }
     
        set
        {
            this._separatorText = value;
        }
    }
    private string _separatorText;
    private string _separatorPage;


    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered