Panelbar not collapse/expand if I add it at runtime

2 posts, 0 answers
  1. Kaushal
    Kaushal avatar
    47 posts
    Member since:
    Sep 2010

    Posted 05 Mar 2012 Link to this post


    Here I am adding panelbar and panelbaritems at runtime. Also I am applying skin to panelbar while I am creating it. As panelbar and all things creates successfully but when I am clicking on panelbar its not collapsing or expanding. Here is my code:

    private RadPanelBar PreparePanelBar()
           RadPanelBar objRadPanelBar = new RadPanelBar();
           objRadPanelBar.ID = Guid.NewGuid().ToString();
           objRadPanelBar.Skin = "PanelbarDup"; //This point to my app_themes and from there it ref. to custom skin library
           objRadPanelBar.EnableEmbeddedSkins = false;
           objRadPanelBar.Width = Unit.Percentage(100);
           objRadPanelBar.ExpandMode = PanelBarExpandMode.MultipleExpandedItems;
           return objRadPanelBar;
       private RadPanelItem PrepareRadPanelItem(string _rpbCaption,bool isExpanded)
           //Prepare RadPanelItem under passed RadPanelBar
           RadPanelItem objRadPanelItem = new RadPanelItem();
           objRadPanelItem.Text = _rpbCaption;
           objRadPanelItem.Expanded = isExpanded;
           return objRadPanelItem;
       protected void btnOk_Click(object sender, EventArgs e)
           //Prepare Tab
           RadPanelBar objPanelbar = PreparePanelBar();
           //Prepare Sections
           RadPanelItem objPanelItem = PrepareRadPanelItem("Basic Information", true);
           //Prepare Dynamic HTML Table under Section
           // Add the table to the placeholder control
  2. Peter
    Peter avatar
    6637 posts

    Posted 08 Mar 2012 Link to this post

    Hi Kaushal,

    If you need to have the expand/collapse functionality you should create a root item and then add a child item to it. Alternatively, you can use content template. More on templates you can learn here.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top