RadPanel Expand Child items

4 posts, 0 answers
  1. Allan
    Allan avatar
    121 posts
    Member since:
    Jun 2008

    Posted 28 Jun 2012 Link to this post

    I am probaly missing something but how does one expand child items of a child of a root item when the child is clicked when using a databound radpanel?
    <telerik:RadPanelBar ID="RadPanelBar1" Runat="server" DataFieldID="DataFieldID"
        DataFieldParentID="DataFieldParentID"
        DataNavigateUrlField="DataNavigateUrlField" DataSourceID="sds_ITC_MenuConsole"
        DataTextField="DataTextField" DataValueField="DataTextField" Width="250px"
        PersistStateInCookie="True" Skin="WebBlue" ExpandMode="MultipleExpandedItems">
        <DataBindings>
            <telerik:RadPanelItemBinding SelectedImageUrlField="ImageURL"
                ExpandedImageUrlField="ImageURL" HoveredImageUrlField="ImageURL"
                ImageUrlField="ImageURL" />
            <telerik:RadPanelItemBinding ImageUrlField="ImageURL" />
        </DataBindings>
    </telerik:RadPanelBar>


    Root 32 NULL Network Operations Center ~/ITC_Console/noc/noc.aspx
    Child 33 32 NOC Tools NULL
    Child Item 34 33 Server Room Check Log ~/ITC_Console/noc/server_room_check_log.aspx
    Child Item 35 33 Master Projects ~/ITC_Console/noc/master_projects.aspx
    Child Item 36 33 Projects ~/ITC_Console/noc/projects.aspx
    Child Item 37 33 Tasks ~/ITC_Console/noc/tasks.aspx
    Child Item 38 33 Parts on Order ~/ITC_Console/noc/parts.aspx
    Child Item 39 33 Procedures Calendar ~/ITC_Console/noc/procedures/procedures.aspx
    Child Item 40 33 NOC Notes ~/ITC_Console/noc/noc_notes/noc_notes.aspx





  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 03 Jul 2012 Link to this post

    Hello Allan,

    Please, try the approach from this help topic. It is a client-side solution, so it is irrelevant how RadPanelBar is populated, whether declaratively or through data binding.

    Regards,
    Peter
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Allan
    Allan avatar
    121 posts
    Member since:
    Jun 2008

    Posted 03 Jul 2012 Link to this post

    I did try that example prior to posting. I have now attempted it again. The child items of a child item still do not expand. Perhaps some other setting in my Panel Control is preventing correct behavior?
    <telerik:RadPanelBar ID="RadPanelBar1" Runat="server" DataFieldID="DataFieldID"
        DataFieldParentID="DataFieldParentID"
        DataNavigateUrlField="DataNavigateUrlField" DataSourceID="sds_ITC_MenuConsole"
        DataTextField="DataTextField" DataValueField="DataTextField" Width="250px"
        PersistStateInCookie="True" Skin="WebBlue" ExpandMode="MultipleExpandedItems" OnClientItemClicking="ExpandAllChildren">
        <DataBindings>
            <telerik:RadPanelItemBinding SelectedImageUrlField="ImageURL"
                ExpandedImageUrlField="ImageURL" HoveredImageUrlField="ImageURL"
                ImageUrlField="ImageURL" />
            <telerik:RadPanelItemBinding ImageUrlField="ImageURL" />
        </DataBindings>
    </telerik:RadPanelBar>

  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 05 Jul 2012 Link to this post

    Hi Allan,

    Here is the test code I tried but it worked as expected at my side:
    <script type="text/javascript">
           function ExpandAllChildren(sender, args) {
               enumerateChildItems(args.get_item());
           }
     
           function enumerateChildItems(myitem) {
               for (var i = 0; i < myitem.get_items().get_count(); i++) {
                   myitem.get_items().getItem(i).expand()
                   enumerateChildItems(myitem.get_items().getItem(i));
               }
           }
       </script>
       <telerik:RadPanelBar ID="RadPanelBar1" runat="server" OnClientItemClicking="ExpandAllChildren">
           <Items>
               <telerik:RadPanelItem runat="server" Text="Root RadPanelItem1">
                   <Items>
                       <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 1">
                           <Items>
                               <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 1">
                                   <Items>
                                       <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 1">
                                       </telerik:RadPanelItem>
                                       <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 2">
                                       </telerik:RadPanelItem>
                                   </Items>
                               </telerik:RadPanelItem>
                               <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 2">
                               </telerik:RadPanelItem>
                           </Items>
                       </telerik:RadPanelItem>
                       <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 2">
                       </telerik:RadPanelItem>
                   </Items>
               </telerik:RadPanelItem>
               <telerik:RadPanelItem runat="server" Text="Root RadPanelItem2">
                   <Items>
                       <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 1">
                           <Items>
                               <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 1">
                               </telerik:RadPanelItem>
                               <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 2">
                               </telerik:RadPanelItem>
                               <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 3">
                               </telerik:RadPanelItem>
                               <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 4">
                               </telerik:RadPanelItem>
                           </Items>
                       </telerik:RadPanelItem>
                       <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 2">
                       </telerik:RadPanelItem>
                       <telerik:RadPanelItem runat="server" Text="Child RadPanelItem 3">
                       </telerik:RadPanelItem>
                   </Items>
               </telerik:RadPanelItem>
               <telerik:RadPanelItem runat="server" Text="Root RadPanelItem3">
               </telerik:RadPanelItem>
           </Items>
       </telerik:RadPanelBar>

    Clicking a root item expands all levels of child items down the hierarchy. Please, let me know if I am missing something.


    Kind regards,
    Peter
    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