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

RadPanel Expand Child items

3 Answers 39 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Allan
Top achievements
Rank 2
Allan asked on 28 Jun 2012, 11:01 PM
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





3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 03 Jul 2012, 09:56 AM
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.
0
Allan
Top achievements
Rank 2
answered on 03 Jul 2012, 06:24 PM
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>

0
Peter
Telerik team
answered on 05 Jul 2012, 07:46 AM
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.
Tags
PanelBar
Asked by
Allan
Top achievements
Rank 2
Answers by
Peter
Telerik team
Allan
Top achievements
Rank 2
Share this question
or