Nested RadPanelBar not expanding

4 posts, 0 answers
  1. Shivers999
    Shivers999 avatar
    13 posts
    Member since:
    Feb 2010

    Posted 22 Mar 2011 Link to this post

    I'm working on a custom usercontrol that nests 2 RadPanelBars - one RadPanelBar inside each of its parent's RadPanelItem - in Sitefinity 3.7.2057.2. The parent RadPanelBar expands/collapses as it should, however the child RadPanelBar doesn't expand or collapse. Can you tell me how to fix it?


    This is all that exists in my ascx.

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="RadPa...
      
    <telerik:RadPanelBar ID="RadPanelBarParent" runat="server" Skin="Default">
    </telerik:RadPanelBar>


    Codebehind Snippet that builds the RadPanelBar:
    foreach (Guid id in ListsIds)
                {
                    //Create new bar
                    RadPanelItem NewItem = new RadPanelItem(manager.GetList(id).Name);
                    RadPanelItem InternalParentItem = new RadPanelItem();
                    // Create new PanelBar
                    RadPanelBar ChildPanelBar = new RadPanelBar();
                      
                    //Add to the child
                    NewItem.Items.Add(InternalParentItem);
                      
                    // Add the panelbar to the new item
                    InternalParentItem.Controls.Add(ChildPanelBar);
                      
                    //Add the parent
                    RadPanelBarParent.Items.Add(NewItem);
      
                         
                    foreach(IListItem listItem in manager.GetListItems(id)){
                          
                        //Create new bar
                        RadPanelItem ChildItem = new RadPanelItem(listItem.Headline);
                        RadPanelItem InternalChildItem = new RadPanelItem();
      
                        // Bind the template
                        InternalChildItem.ItemTemplate = new TextBoxTemplate();
                          
                        //Add to the child
                        ChildItem.Items.Add(InternalChildItem);
                          
                        // Set the content
                        InternalChildItem.Value = listItem.Content.ToString();
                          
                        //Add to the parent
                        ChildPanelBar.Items.Add(ChildItem);
                      }
                }
  2. Shivers999
    Shivers999 avatar
    13 posts
    Member since:
    Feb 2010

    Posted 23 Mar 2011 Link to this post

    I solved my own problem. Nested RadPanelBars don't work and aren't necessary, per this forum post.

    Here's the correct code.
    foreach (Guid id in ListsIds)
                {
                    //Create new bar
                    RadPanelItem NewItem = new RadPanelItem(manager.GetList(id).Name);
                      
                    //Add the parent
                    RadPanelBarParent.Items.Add(NewItem);
        
                    foreach(IListItem listItem in manager.GetListItems(id)){
                          
                        //Create new bar
                        RadPanelItem ChildItem = new RadPanelItem(listItem.Headline);
                        RadPanelItem InternalChildItem = new RadPanelItem();
                          
                        //Add to the child
                        ChildItem.Items.Add(InternalChildItem);
                          
                        // Set the content
                        InternalChildItem.Value = listItem.Content.ToString();
                          
                        //Add to the parent
                        NewItem.Items.Add(ChildItem);
                    }
                }


  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Anjali
    Anjali avatar
    101 posts
    Member since:
    Dec 2010

    Posted 23 Mar 2011 Link to this post

    I don't see  radPanelBarParent.Do I need to add any reference? I don't see RadpanelBarparent in the examples either.

  5. Shivers999
    Shivers999 avatar
    13 posts
    Member since:
    Feb 2010

    Posted 23 Mar 2011 Link to this post

    RadPanelParent is just the ID of the RadPanelBar in my ascx file. It's shown in the first post.

    <telerik:RadPanelBar ID="RadPanelBarParent" runat="server" Skin="Default">
    </telerik:RadPanelBar>
Back to Top