Expand/collapse server side

2 posts, 0 answers
  1. David
    David avatar
    3 posts
    Member since:
    Mar 2011

    Posted 16 Mar 2011 Link to this post

    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?

  2. David
    David avatar
    3 posts
    Member since:
    Mar 2011

    Posted 16 Mar 2011 Link to this post

    Resolved - took off the PersistStateInCookie="true" attribute and it all worked.

Back to Top