More in this section

Forums / Developing with Sitefinity / SitePanelBar - How to show only the first 2 levels

SitePanelBar - How to show only the first 2 levels

3 posts, 0 answered
  1. Eric Wallace
    Eric Wallace avatar
    66 posts
    Registered:
    08 Oct 2009
    09 Apr 2010
    Link to this post
    My current navigation structure is:

    Home

    Human Resources
    ----Forms
    --------W4
    -------- FMLA Request for Leave
    ----Health & Wellness

    Products

    My question is, how do I get the sitepanelbar to display only the first two levels? So if I'm on the "W4" page, I only want the panel bar to show:
    Human Resources
    ----Forms
    ----Health & Welness

    I have set
    StartingNodeOffset = 1
    StartFromCurrentNode = False
    ShowStartingNode = True,
    MaxDataBoundItems = 2.

    The odd thing here is that if "Forms" is a group page, then I get the desired behavior. If it's a normal page with child items, only the first node (Human Resources) is shown.

    TIA,
    Eric
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Apr 2010
    Link to this post
    Hi Eric Wallace,

    Override OnPreRender of the SitePanelBar. Find the current item by using FindItemByUrl method of the RadPanelBar control. Get the parent of this item ( the parent is "Forms") and hide all child items of the parent by using Visible property of the RadPanelItem.

    All the best,
    Ivan Dimitrov
    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. Eric Wallace
    Eric Wallace avatar
    66 posts
    Registered:
    08 Oct 2009
    19 Apr 2010
    Link to this post
    Thanks for the tip Ivan, unfortunately it did not work for what I was wanting to do. What did work was the following:

    StartingNodeOffset = 1
    StartFromCurrentNode = False
    ShowStartingNode = True

    Misc > PanelBar > Behavior > ExpandMode =  SingleExpandedItem
    Misc > PanelBar > Data > MaxDataBindDepth = 2

    protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
     
            foreach (RadPanelItem item in RadPanelbar1.GetAllItems())
            {
                if (item.Parent.Parent is RadPanelItem)
                    item.Visible = false;
            }       
        }
Register for webinar
3 posts, 0 answered