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

Forums / Developing with Sitefinity / Make SitePanelBar always show all nodes?

Make SitePanelBar always show all nodes?

15 posts, 0 answered
  1. License Developer
    License Developer avatar
    31 posts
    Registered:
    18 Jun 2008
    17 Jun 2008
    Link to this post
    Hi,

    I'm using the sitepanelbar for a left hand navigation control and I want to have it so that it always shows all of it's links, not collapse / expand. Is there a setting under it's properties that I can set? Thanks
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    18 Jun 2008
    Link to this post
    Hi Brett,

    You need to modify ~/Sitefinity/UserControls/Navigation/SitePanelbar.ascx control as follows:

    .ascx
    <script type="text/javascript"
     
       function ExpandAllItems() 
          { 
           var PanelBar = <%= RadPanelbar1.ClientID %>
            for (var i=0; i<PanelBar.AllItems.length; i++) 
               { 
                  var panelItem = PanelBar.AllItems[i]; 
                  panelItem.Expand(); 
               } 
          } 
    </script> 
     
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false"/> 
    <radP:RadPanelbar ID="RadPanelbar1" runat="server" OnClientLoad="ExpandAllItems"  DataSourceID="SiteMapDataSource1" OnItemDataBound="RadPanelbar1_ItemDataBound" EnableViewState="false"
    </radP:RadPanelbar> 

    Hope this helps.


    Best wishes,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. License Developer
    License Developer avatar
    31 posts
    Registered:
    18 Jun 2008
    19 Jun 2008
    Link to this post
    Pepi,

    You're a genius! It works perfectly, thanks!!
  4. License Developer
    License Developer avatar
    31 posts
    Registered:
    18 Jun 2008
    19 Jun 2008
    Link to this post
    One more question about this. My menu expands by default now but a user can still click on the headers and make them collapse, can I add something into the function that you gave me that will make it so that mouseclicks on the top level elements are ignored?

    This image should help:
    http://img517.imageshack.us/img517/9796/sitepanelbarquestioneb4.jpg

    If I click on "Featured Articles" or "Market Highlights" those sections collapse and expand. We want them to behave just as though they were titles and not modify how the navigation reacts.

    Thanks again your help is very, very appreciated.

    Brett
  5. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    20 Jun 2008
    Link to this post
    Hello Brett,

    We cannot reproduce the described behavior. All Panelbar items are expanded when the user clicks a first level item. So we will need more details to assist you. What browser do you use and what version? It will be very helpful if you give us online access to the administration of your site.

    Thanks for your cooperation in advance.

    Greetings,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Natalia
    Natalia avatar
    10 posts
    Registered:
    08 Sep 2008
    29 Sep 2008
    Link to this post
    I need to do the same thing, but with a "CategoryPanelBar". How do I keep the side submenu items always open?
  7. Natalia
    Natalia avatar
    10 posts
    Registered:
    08 Sep 2008
    29 Sep 2008
    Link to this post
    Just an addition, the site inner page is at

    http://windows.idea-bureau.com/Vadim/Products.aspx

    I think I screwed something up by trying to add the above line to CategoryPanelbar.ascx. I get a wierd page refresh in IE6 whenever I roll over the panel bar items now.
  8. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    29 Sep 2008
    Link to this post
    Hi Natalia,

    Unfortunately, we can not reproduce any problem after modifying CategoryPanelbar.ascx user control. Please make sure you have added OnClientLoad="ExpandAllItems" in the RadPanelBar declaration like this:

    <radP:RadPanelbar ID="RadPanelbar1" runat="server" OnClientLoad="ExpandAllItems" DataSourceID="SiteMapDataSource1" OnItemDataBound="RadPanelbar1_ItemDataBound" EnableViewState="false"
    </radP:RadPanelbar> 

    If the above does not help, please post the code of your user control to test it locally.

    Greetings,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. Natalia
    Natalia avatar
    10 posts
    Registered:
    08 Sep 2008
    29 Sep 2008
    Link to this post
    the above did not help. Here are the lines from CategoryPanelbr.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="CategoryPanelbar.ascx.cs" Inherits="UserControls_CategoryPanelbar" %>
    <%@ Register Assembly="RadPanelbar.Net2" Namespace="Telerik.WebControls" TagPrefix="radP" %>

    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
    <radP:RadPanelbar ID="RadPanelbar1" runat="server" OnClientLoad="ExpandAllItems" DataSourceID="SiteMapDataSource1" OnItemDataBound="RadPanelbar1_ItemDataBound" EnableViewState="false">

    </radP:RadPanelbar>

  10. Natalia
    Natalia avatar
    10 posts
    Registered:
    08 Sep 2008
    29 Sep 2008
    Link to this post
    I have just deleted both of CategoryPanelPar.aspx and CategoryPanelbar.ascx.cs off the server completely, and the panel bar is still there and behaving the same. ???
  11. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    30 Sep 2008
    Link to this post
    Hello Natalia,

    Note that your control should contain the implementation of the ExpandAllItems javascript function like this:

    .ascx
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="CategoryPanelbar.ascx.cs" Inherits="UserControls_CategoryPanelbar" %> 
    <%@ Register Assembly="RadPanelbar.Net2" Namespace="Telerik.WebControls" TagPrefix="radP" %> 
     
    <script type="text/javascript">  
     
    function ExpandAllItems()  
      {  
        var PanelBar = <%= RadPanelbar1.ClientID %>;  
        for (var i=0; i<PanelBar.AllItems.length; i++)  
           {  
              var panelItem = PanelBar.AllItems[i];  
              panelItem.Expand();  
           }  
      }  
     
    </script>  
     
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" /> 
    <radP:RadPanelbar ID="RadPanelbar1" runat="server" OnClientLoad="ExpandAllItems" DataSourceID="SiteMapDataSource1" OnItemDataBound="RadPanelbar1_ItemDataBound" EnableViewState="false"
    </radP:RadPanelbar> 
     

    Regarding your second post, most probably the issue is related to the caching.

    Do let us know how it goes.

    All the best,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  12. Orion
    Orion avatar
    54 posts
    Registered:
    02 Feb 2009
    17 Jun 2009
    Link to this post
    I was able to get this functionality working for the SiteTreeview, but not for SitePanelbar.  I put the exact code you showed above directly into "SitePanelbar.ascx" but it's only showing the top level, and one level underneath.  It's not automatically expanding the page groups to show the third level of pages.

    Any idea what else might be happening here?

    Thanks,
    Orion
  13. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Jun 2009
    Link to this post
    Hello Orion,

    Please give a try to the code samples below:

    1. Using ClientSide

     <script type="text/javascript"
         function ExpandAll(sender, eventArgs) { 
             var panelBar = $find("<%= RadPanelbar1.ClientID %>"); 
             for (var i = 0; i < panelBar.get_allItems().length; i++) { 
                 panelBar.get_allItems()[i].expand(); 
             } 
     
         } 
       </script> 
     
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false"/> 
    <telerik:RadPanelBar ID="RadPanelbar1" runat="server"  
    DataSourceID="SiteMapDataSource1"  
    OnItemDataBound="RadPanelbar1_ItemDataBound"  
    EnableViewState="false" OnClientLoad="ExpandAll"
    </telerik:RadPanelBar> 

    or

    2. Using ServerSide

    protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!Page.IsPostBack) 
            { 
                ICmsUrlContext urlContext = CmsUrlContext.Current; 
                if (urlContext != null
                { 
                    RadPanelbar1.DataBind(); 
                    string currentUrl = SiteMapDataSource1.Provider.CurrentNode.Url; 
                    foreach (RadPanelItem item in RadPanelbar1.GetAllItems()) 
                    { 
                       item.Expanded = true
                    } 
                } 
            } 
        } 
     
     
     
    Sincerely yours,
    Ivan Dimitrov
    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.
  14. Jay Mehta
    Jay Mehta avatar
    28 posts
    Registered:
    30 Jun 2009
    02 Sep 2009
    Link to this post
    Hi,

    I'm using the sitepanelbar for a left hand navigation control and I have modified the css file to change the look and feel. Now it looks as we want, but the problem I am facing is, the items are expanded by default, and also they do not collapse on the click. If I set the EnableTheming property of the Sitepanelbar to false, it changes the look to default, but the collapse/expand property works properly.   Any inputs on this?

    Thank you,
    Jay Mehta.
  15. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    01 Jun 2017
    03 Sep 2009
    Link to this post
    Hello Jay Mehta,

    We sent you a response in your support ticket. Please follow up there if you have any further questions. 

    Greetings,
    Nikolai
    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
15 posts, 0 answered