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

Expand Panel with Animation using Javascript

1 Answer 97 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Ozan
Top achievements
Rank 1
Ozan asked on 08 Nov 2008, 10:50 AM
Hi there,

I have a panelbar with 4 bar items which have template contents.

Is it possible to expand/collapse a panel item with javascript also maintaining the collapse and expand animations ?

Thanks in advance...

Ozan GUNCELER

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Nov 2008, 10:19 AM
Hello Ozan,

Try out the following code to expand or collapse a panelbar item on clicking a button.
aspx:
<telerik:RadPanelBar ID="RadPanelBar1" runat="server"
 <Items> 
  <telerik:RadPanelItem Text="Category"
    <Items> 
     <telerik:RadPanelItem Text="FootBall"></telerik:RadPanelItem> 
     <telerik:RadPanelItem Text="Men'sGolf"></telerik:RadPanelItem> 
     <telerik:RadPanelItem Text="Women'sFootBall"></telerik:RadPanelItem> 
    </Items> 
   </telerik:RadPanelItem> 
  </Items> 
</telerik:RadPanelBar> 
         
<asp:Button ID="Button5" runat="server" Text="PanelExpand/Collapse" OnClientClick="PanelExpandCollapse()" /> 

js:
<script type="text/javascript"
 function PanelExpandCollapse() 
 { 
  var panelbar=$find("<%=RadPanelBar1.ClientID %>"); 
  var item = panelbar.findItemByText("Category"); 
  if(item.get_expanded()==false) 
  { 
   item.set_expanded(true); 
  } 
  else 
  { 
  item.set_expanded(false); 
  } 
 } 
</script> 

Thanks
Princy.
Tags
PanelBar
Asked by
Ozan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or