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

Expand/collapse server side

1 Answer 158 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 16 Mar 2011, 02:00 PM

I have the following RadPanelBar in my page with individual the items bound programatically server-side to their respective datasources.

<telerik:RadPanelBar ID="rpbHomePanel" runat="server" ExpandMode="MultipleExpandedItems" 
       Height="100%" PersistStateInCookie="true">
       <items>
       <telerik:RadPanelItem runat="server" Text="My People" Expanded="true" ChildGroupHeight="250px" Value="MyPeople"
           PostBack="true">
           <ContentTemplate>
               <asp:UpdatePanel ID="updMyPeople" UpdateMode="Conditional"  runat="server">
                   <ContentTemplate>
                       <uc1:ucMyPeople ID="ucMyPeople" runat="server" />
                   </ContentTemplate>
               </asp:UpdatePanel>
           </ContentTemplate>
       </telerik:RadPanelItem>
       <telerik:RadPanelItem  runat="server" Text="My Dealers" ChildGroupHeight="250px" Value="MyDealers">
           <ContentTemplate>
               <asp:UpdatePanel ID="updMyDealers" UpdateMode="Conditional" runat="server">
                   <ContentTemplate>
                       <uc2:ucMyDealers ID="ucMyDealers" runat="server" />
                   </ContentTemplate>
               </asp:UpdatePanel>
           </ContentTemplate>
       </telerik:RadPanelItem>
       <telerik:RadPanelItem runat="server" Text="My Alerts" ChildGroupHeight="250px" Value="MyAlerts">
           <ContentTemplate>
               <asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">
                   <ContentTemplate>
                       <uc1:ucMyAlerts ID="ucMyAlerts" runat="server" />
                   </ContentTemplate>
               </asp:UpdatePanel>
           </ContentTemplate>
       </telerik:RadPanelItem>
   </items>
   </telerik:RadPanelBar>


 

I also have the following code in an event handler to iterate through the items to expand/collapse the items based on certain conditions

protected void ucMyPeople_OnDataChanged(String name)
   {
       foreach (RadPanelItem rpi in rpbHomePanel.Items)
       {
           if (name == "D")
           {
               if (rpi.Value == "MyPeople")
               {
                   rpi.Expanded = false;
               }
               if (rpi.Value == "MyDealers")
               {
                   rpi.Expanded = true;
               }
               if (rpi.Value == "MyAlerts")
               {
                   rpi.Expanded = false;
               }
           }
           if (name == "P")
           {
               if (rpi.Value == "MyPeople")
               {
                   rpi.Expanded = true;
               }
               if (rpi.Value == "MyDealers")
               {
                   rpi.Expanded = false;
               }
               if (rpi.Value == "MyAlerts")
               {
                   rpi.Expanded = false;
               }
           }
           if (name == "A")
           {
               if (rpi.Value == "MyPeople")
               {
                   rpi.Expanded = false;
               }
               if (rpi.Value == "MyDealers")
               {
                   rpi.Expanded = false;
               }
               if (rpi.Value == "MyAlerts")
               {
                   rpi.Expanded = true;
               }
           }
       }

None of this is working. Only the top item is ever expanded – the others remain collapsed no matter whether I set expand to true or not. I have even tried setting the second item up with Expanded=”true” in the page declaration. Still no joy.

 

Can you suggest what I might be dong wrong please?

1 Answer, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 16 Mar 2011, 04:46 PM
Resolved - took off the PersistStateInCookie="true" attribute and it all worked.
Tags
PanelBar
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Share this question
or