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

Forums / Designing with Sitefinity / Separator between menu items but omit lafter last item

Separator between menu items but omit lafter last item

3 posts, 0 answered
  1. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    11 May 2009
    Link to this post
    Hi there,

    I want to add a separator (simple | character) between my menu items. I followed the instructions here http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-btmmmm.aspx  and it worked quite well. The only issue is that I get a separator after my last menu item and I don't want this. Does anyone have any suggestions/samples on how to get around this? I know I need to know the total count of items to figure out when to stop, but at the point in the binding when the separator is being added I don't know the total yet. 

    Any help is greatly appreciated!
    Cheers,
    Phill
  2. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    12 May 2009
    Link to this post
    Hello Phill Hodgkinson,

    Please add this check in the RadMenu1_ItemDataBound method:

    public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e) 
        if (e.Item.Level == 0) 
        { 
            CmsSiteMapNode dataItem = e.Item.DataItem as CmsSiteMapNode; 
            if (dataItem.NextSibling != null
            { 
                this.InsertSeparator(e.Item.Index + 1, this.RadMenu1); 
            } 
         }  
     
         ........ 

    I hope this will help you.

    Kind regards,
    Parvan
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  3. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    12 May 2009
    Link to this post
    Hi Parvan,

    Just what I was looking for, thanks so much!

    Cheers,
    Phill
Register for webinar
3 posts, 0 answered