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

Dynamic Content

1 Answer 75 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Peter Zolja
Top achievements
Rank 1
Peter Zolja asked on 04 Oct 2008, 02:37 AM
If I have this in the ASPX

<telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Outlook" Width="190px" ExpandMode="MultipleExpandedItems">   
  <CollapseAnimation Duration="100" Type="None" /> 
  <ExpandAnimation Duration="100" Type="None" /> 
</telerik:RadPanelBar> 

And I try to do this from C#

var m1 = new RadPanelItem("item 1"); 
m1.Items.Add(new RadPanelItem("sub1")); 
m1.Items.Add(new RadPanelItem("sub2")); 
m1.Items.Add(new RadPanelItem("sub3")); 
RadPanelBar1.Items.Add(m1); 
 
var m2 = new RadPanelItem("item 2"); 
m2.Items.Add(new RadPanelItem("sub1")); 
m2.Items.Add(new RadPanelItem("sub2")); 
m2.Items.Add(new RadPanelItem("sub3")); 
RadPanelBar1.Items.Add(m2); 

It works fine, however when I try to add custom content rather than RadPanelItems like this:

var m1_d = new RadPanelItem("item custom"); 
m1_d.Controls.Add(new Label() { Text = "sub1", ID = "s1" }); 
m1_d.Controls.Add(new Label() { Text = "sub2", ID = "s2" }); 
m1_d.Controls.Add(new Label() { Text = "sub3", ID = "s3" }); 
RadPanelBar1.Items.Add(m1_d); 

while I see the results on the page when clicking on the header the panel bar would not collapse. From a quick look at the rendered HTML the rpExpandable CSS class is not applied in the later case (when adding labels) -- not sure if this makes a difference or not.

Thanks.

P.S. this behavior is not browser specific.

1 Answer, 1 is accepted

Sort by
0
Peter Zolja
Top achievements
Rank 1
answered on 05 Oct 2008, 06:36 PM
The answer is at the end of this post:

http://www.telerik.com/community/forums/thread/b311D-bgdgdd.aspx

It is a rather silly workaround, at least from the perspective of a control user. I hope you will reconsider how this works.
Tags
PanelBar
Asked by
Peter Zolja
Top achievements
Rank 1
Answers by
Peter Zolja
Top achievements
Rank 1
Share this question
or