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

Expand Parent and Child Items Client Side

3 Answers 69 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Elke Kaminski
Top achievements
Rank 1
Elke Kaminski asked on 03 May 2012, 07:15 PM
Hi there,

I try to expand the parent and child items in client-side but it seems that you can't. This is my code:

function OnClientItemClicking(sender, eventArgs) {
            var item = eventArgs.get_item();
             
            if (item.get_expanded()) {
                item.collapse();
            }
            else {
                item.expand();
            }
 
            var panelBar = $find("ctl00_RadPanelBar1");
 
            var panelItem = panelBar.findItemByValue("AccountFooter");
            panelItem.show();
 
            panelItem = panelBar.findItemByValue("TopicFooter");
            panelItem.hide();
 
            var parentItem = item.get_items().getItem(0);
            parentItem.expand();
 
            eventArgs.set_cancel(true); // Cancel the postback
           
        }

Thanks for quick help!
Claudio

3 Answers, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 08 May 2012, 04:00 PM
Hello Elke,

Looking at the code that you provided I can not find a reason why it is not working as expected. I would suggest that you take a look at the following demo as well where you can find a working example of how to expand/collapse RadPanelItems on the client-side. In case this does not help I would ask you to provide the markup that you use as well as explain the desired functionality that you are trying to achieve.

Kind regards,
Kate
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
Elke Kaminski
Top achievements
Rank 1
answered on 10 May 2012, 07:06 AM
Hi Kate,

the demo doesn't help me.

I have two Root Items in the PanelBar:

Root 1
          --> ParentChild 1
                      --> Child 1
                      --> Child 2
Root 2
          --> ParentChild 1
                      --> Child 1
                      --> Child 2

Initial state is that all Items are collapsed. When clicking the first Root Item and after that clicking the second Root Item the second Root Item expands but the Child items don't. When I click the second root item then twice after that it expands the child items correctly.

When clicking the second Root Item first (from initial state where everything is collapsed) it correctly expands its childitems.

Thanks for quick help!
Claudio
0
Kate
Telerik team
answered on 11 Jun 2012, 02:46 PM
Hi Claudio,

Can you please provide the markup that you are using so I can test you scenario locally and inspect what is causing the behavior that you get? 

Greetings,
Kate
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
Elke Kaminski
Top achievements
Rank 1
Answers by
Kate
Telerik team
Elke Kaminski
Top achievements
Rank 1
Share this question
or