PanelBar Expand items

7 posts, 1 answers
  1. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 06 Sep 2012 Link to this post

    Is there a way to control what items will be expended when panel bar is first loaded?
    By default it seams to collapse everything.
    I would like to have the second level expended. 
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Sep 2012 Link to this post

    Hi Andrew,

    Try setting Expanded property of RadPanelItem to true to achieve your scenario.Here is the sample code that I tried.

    ASPX:
    <telerik:RadPanelBar ID="RadPanelBar1" runat="server">
      <Items>
       <telerik:RadPanelItem Text="RadPanelItem1">
         <Items>
             ................
         </Items>
       </telerik:RadPanelItem>
       <telerik:RadPanelItem Text="RadPanelItem2" Expanded="true">
         <Items>
             ................
         </Items>
       </telerik:RadPanelItem>
       <telerik:RadPanelItem Text="RadPanelItem3">
         <Items>
             ................
         </Items>
       </telerik:RadPanelItem>
      </Items>
    </telerik:RadPanelBar>

    Hope this helps.

    Regards,
    Princy.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 07 Sep 2012 Link to this post

    Can't do that the items are created dynamically by binding the panelbar to a datasource. Which is actually a sitemap from sitefinity.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Sep 2012 Link to this post

    Hi Andrew,

    Try the following code to achieve your scenario.

    C#:
    RadPanelBar1.Items[1].Expanded = true;

    Hope this helps.

    Regards,
    Princy.
  6. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 09 Sep 2012 Link to this post

    That worked.
    I put in in the ItemBound Event:
    protected void RadPanelBar1_DataBound(object sender, EventArgs e)
            {
                foreach (RadPanelItem myItem in (((RadPanelBar)sender).Items))
                {
                    myItem.Expanded = true;
                }
            }
    Expends only the first level which works well for me.

    I would in fact like to disable to possibility of the end user collapsing that level.

    Is there a property on the item i can set to do so?
  7. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Sep 2012 Link to this post

    Hi Andrew,

    Try setting PreventCollapse property of RadPanelItem to true achieve your scenario.

    C#:
    foreach (RadPanelItem myItem in (RadPanelBar1.Items))
        {
         myItem.Expanded = true;
         myItem.PreventCollapse = true;
        }

    Regards,
    Princy.
  8. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 10 Sep 2012 Link to this post

    Thanks that works.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017