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

Forums / Developing with Sitefinity / Separators for RadMenu child item groups

Separators for RadMenu child item groups

4 posts, 0 answered
  1. Brett
    Brett avatar
    36 posts
    Registered:
    23 Jul 2010
    05 Nov 2010
    Link to this post
    Hi all.

    I need some help. What I am trying to accomplish is this. I have a horizontal site menu with child items that expand vertically. What I am trying to do is to be able to group child items and have separators between groups of child items. Very much like the example here. http://demos.telerik.com/aspnet-ajax/menu/examples/functionality/itemflow/defaultcs.aspx

    If you follow the link and view the demo menu and hover over 'file', you will notice there are 3 separators of the child items. Each root menu item has groups of child items and this is what I would like to accomplish with the out of the box site menu included with Sitefinity.

    Is this possible?

    Thanks in advance for any and all help.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    05 Nov 2010
    Link to this post
    Hi Brett,

    Thank you for using our services.

    This sample seems to be using a declarative data source for the menu. In Sitefinity the menu is populated dynamically from your website's site map. This however does not mean that you cannot add separators for your child items. You can find a sample on how to achieve this in the following forum thread: How to add separator in sitemenu when generating it from sitemapdatasource.

    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. Brett
    Brett avatar
    36 posts
    Registered:
    23 Jul 2010
    05 Nov 2010
    Link to this post
    Thank you very much for the quick reply. The problem is, I want to create a separator between groups of items rather than between each and every item. Is this impossible?

    Thanks!
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    05 Nov 2010
    Link to this post
    Hi Brett,

    This is possible. You have to define the condition which when satisfied you will add a separator. For example you may need to add it if the page's name is PageName:
    public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e)
    {
        //get the sitemap node being bound
        CmsSiteMapNode node2 = e.Item.DataItem as CmsSiteMapNode;
        //get the respective page
        ICmsPage cmsPage = node2.GetCmsPage();
        if (cmsPage.Name == "PageName")
        {
           //add separator before
            this.InsertSeparator(e.Item.Index - 1, this.RadMenu1);
        }
        if (this.hideUrlForGroupPages)
        {
            CmsSiteMapNode node = e.Item.DataItem as CmsSiteMapNode;
            if (node != null)
            {
                // save the PageID in the attributes of the menu item
                e.Item.Attributes.Add("PageID", node.Key);
     
                if (node.PageType == CmsPageType.Group)
                {
                    e.Item.NavigateUrl = "";
                }
            }
        }
    }



    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
Register for webinar
4 posts, 0 answered