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

Forums / Developing with Sitefinity / Dynamically Populating a Panel Bar

Dynamically Populating a Panel Bar

12 posts, 0 answered
  1. Ben
    Ben avatar
    18 posts
    Registered:
    12 May 2008
    26 Jun 2009
    Link to this post
       Please assist in binding page links to a panel bar.
       My client wants to have a top of page, horizontal menu driven off the site's structure, with only some of the pages having menu entries.  No problem with this.   They also want, depending on which page is selected, to have a panel bar on the left, with a hierarchy, and links to other pages - not a repeat of what's in the horizontal menu, just individual groups of links in a panel bar, different sets on different pages.  If this was static, it'd be no problem. 
       They want to be able to add pages to the site, and then place entries to those pages on the panel bar on the left.  Note that these newly added pages may NOT appear in the horizontal menu on the top.
       If I put a SitePanelBar on the left side of the page, it replicates all of the links that are in the top menu.  If I put a RadPanelBar on the left side, it doesn't put the links there (a good start), but I don't know how to populate that control with pages controlled by my user as content.
       Any ideas?
       Thanks,
           Ben
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 May 2017
    26 Jun 2009
    Link to this post
    Hi Ben,

    I do not quite fully understand this requirement and what pages you want to see bounded to the RadPanelBar control. You can use SitePanelBar ( the Sitefinity' s RadPanelBar control) which exposes several properties that can be used to control the binding and showing of the nodes.
    Generally the control is bounded to Cms SiteMapDataSource of Sitefinity by asp SiteMapDataSource control.

    All the best,
    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.
  3. Ben
    Ben avatar
    18 posts
    Registered:
    12 May 2008
    27 Jun 2009
    Link to this post
    Yes, I know it's confusing.  Here's an example:
       The client has a page called Technologies.aspx.  A menu option for that will appear on the horizontal menu on top of the page.  When clicked, it will open up the Technologies.aspx page.
       The Technologies.aspx page will have a PanelBar on the left, with entries for pages like "development.aspx", "networking.aspx", "database.aspx".  None of these will appear in the top (horizontal) menu.  If the user wants to create a new page called 'iphone.aspx' and insert that between the first and second items on the PanelBar, they need to be able to do that via content management.
       They may have another page called Portfolio.aspx linked to from the top (horizontal) menu.  That page, when displayed, would have its own PanelBar, with one entry for each project that they want to highlight.  Again, they should be able to add pages, and add links to those pages in the PanelBar, via content mangement.
       Does that help explain it?
          Ben
      
  4. Michael
    Michael avatar
    4 posts
    Registered:
    06 May 2009
    27 Jun 2009
    Link to this post
    Ben,

    Did you try setting the StartingNodeOffset property on the PanelBar? You should be able to get the desired effect using this property, if I'm reading your requirement accurately.

    If you using a SiteTabStrip for the horizontal nav you can use the ShowOnlyFirstLevel setting to control whether subpages show up in the SiteTabStrip.

    One thing you'll need to do is to organize the pages you want in the PanelBar to be subpages of a page that's populated in the top nav.

    So Technologies.aspx would have sub pages like this:

    Technologies.aspx
        > development.aspx
        > networking.aspx...

    Once you do this, the top nav should only have a link for Technologies.aspx.
    Then each subpage should have a PanelBar in it that will list all the SubPages of Technologies when you set the StartingNodeOffset to 1.

    If you look at the SiteFinity sample pages you'll see this exact structure.

    You can also toggle a page setting to have the page listed in navigation controls or not.
  5. Ben
    Ben avatar
    18 posts
    Registered:
    12 May 2008
    28 Jun 2009
    Link to this post
    Michael,
        The pages subordinate to Technologies - I want them to appear in the panel bar, but not in the top level menu.  If I add them to the navigation, they show up in both places.  How do I allow them from the panel bar but hide them in the top level horizontal menu?
        Ben
  6. Ben
    Ben avatar
    18 posts
    Registered:
    12 May 2008
    28 Jun 2009
    Link to this post
    Michael,
       One additional bit of information: some top level menu items, like the Technologies example I gave, can appear in the top level menu without children.  Others, such as a 'who we are' link, would have children that must appear in the top level menu (contact us, about us, ...).  So, restricting the top level menu/tab strip to one level won't work.
       Does that help define the problem?
          Ben
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 May 2017
    01 Jul 2009
    Link to this post
    Hi Ben,

    You need to subscribe for RadMenu PreRender method and clear the child items for a root item. Then set StartingNodeOffset for the PanelBar control that will be on your Technologies pages. Just to let you know I sent a reply to your support reqest with code sample.

    Greetings,
    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.
  8. Kris
    Kris avatar
    3 posts
    Registered:
    20 Jun 2009
    11 Jul 2009
    Link to this post
    Ivan,
      Any chance that you could share that code sample on here?  ;)

       Thanks,
          Kris
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 May 2017
    12 Jul 2009
    Link to this post
    Hi Kris,

    Below is the code that will clear all child items as discussed in the last post.

       void RadMenu1_PreRender(object sender, EventArgs e)  
        {  
            // call the base and get all RadMenu Items  
            base.OnPreRender(e);  
            RadMenuItemCollection allItems = RadMenu1.Items;  
            for (int i = 0; i < allItems.Count; i++ )  
            {  
                RadMenuItem item = allItems[i];  
                if (item.Level == 0 && item.Text.Equals("Technologies"))  
                {  
                   // clear the Technologies root item items  
                    item.Items.Clear();  
                }  
            }  
      
        }  

    I hope this helps.

    Regards,
    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.
  10. Kris
    Kris avatar
    3 posts
    Registered:
    20 Jun 2009
    12 Jul 2009
    Link to this post
    Thanks, Ivan! ;)
      I went ahead and just used a SQL Query to get the menu items on the page but not in the menu bar.

       Kris
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 May 2017
    12 Jul 2009
    Link to this post
    Hi Kris,

    I am glad to hear that you have get this working.

    Greetings,
    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.
  12. Kris
    Kris avatar
    3 posts
    Registered:
    20 Jun 2009
    12 Jul 2009
    Link to this post
    Ivan,
      Thank you. Your CMS was recommended by a good friend of mine so I jumped in and have been using the Community version for a friend who owns a non-profit organization (and has very limited funds).

      I've liked what I've seen so far, there is great room for improvement, but I love the RAD stuff!! ;)

      You database is rather confusing, especially the ID's but I'm sure there is a reason for it! ;)

      Anyway, thank you for your prompt response(s). So far my "client" has been extremely satisfied with the CMS interface and I haven't had too much difficulty creating what he wants and needs for his non-prof site!

      I'll come back to these forums if I have any more difficulties!

       Thanks again,
             Kris
Register for webinar
12 posts, 0 answered