This is a migrated thread and some comments may be shown as answers.

RadPanelBar Collapse All items is not working

2 Answers 215 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Amjath
Top achievements
Rank 1
Amjath asked on 07 Jun 2016, 06:05 AM

Hello All,

I want the RadPanelBar to load by collapsing all the items, if the user need to see and they can expand, but collapse all is not happening at all.

In my case my datasource will be like this

Item1

     --Item1.1

     --Item1.2

 

while loading the page I want to see only the Item1 alone

Mark up code:

<telerik:RadPanelBar ID="rdPnlOrgDetail" RenderMode="Lightweight" OnDataBound="rdPnlOrgDetail_DataBound" runat="server" OnPreRender="rdPnlOrgDetail_PreRender" AllowCollapseAllItems="true" ExpandMode="SingleExpandedItem" OnClientLoad="collapseAll">
    
</telerik:RadPanelBar>

 

Dynamically adding the Items 

rdPnlOrgDetail.CollapseAllItems();
           
            var source= getSource();

            rdPnlOrgDetail.Items.Clear();
            RadPanelItem orgItems = new RadPanelItem();
            orgItems.Text = string.Format("{0} : {1}", orgChart.First().OrganisationScope.Scope, orgChart.First().Name.ToString());
            orgItems.Expanded = false;

            for (int i = 1; i < orgChart.Count; i++)
            {
                RadPanelItem orgItem = new RadPanelItem(string.Format("{0} : {1}", orgChart[i].OrganisationScope.Scope, orgChart[i].Name.ToString()));
                orgItem.Expanded = false;
                orgItems.Items.Add(orgItem);
                orgItems.Expanded = false;
            }
            orgItems.Expanded = false;
            rdPnlOrgDetail.Items.Add(orgItems);
            rdPnlOrgDetail.CollapseAllItems();

 

please do the needful.

 

With Thanks 

Amjath

2 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 09 Jun 2016, 03:33 PM
Hello ,

In the attachment, you will find the sample page, that we used to recreate the described scenario. You could use it as a reference. 

Regards,
Peter Milchev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Amjath
Top achievements
Rank 1
answered on 10 Jun 2016, 09:03 AM

Hello Peter Milchev,

Still the collpase was not happening in my project.

the radpanelbar is in the usercontrol and that control was referred in the page, will this be a problem.

With Thanks

Amjath

Tags
PanelBar
Asked by
Amjath
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Amjath
Top achievements
Rank 1
Share this question
or