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

expand and collapse serverside

5 Answers 130 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
appdev
Top achievements
Rank 1
appdev asked on 17 Oct 2008, 10:36 PM
is there a way to expand and collapse the panelitem using server side thanks.i only see example for the client side

5 Answers, 1 is accepted

Sort by
0
Ed
Top achievements
Rank 1
answered on 18 Oct 2008, 08:20 AM
item.Expanded = true/false;
0
appdev
Top achievements
Rank 1
answered on 18 Oct 2008, 12:47 PM
thank you.
0
appdev
Top achievements
Rank 1
answered on 18 Oct 2008, 01:13 PM
now i run into a problem of how to detect that that button was clicked? say i have this structure
panelbar
   item
      panelitem
          item
            panelitem
                itemtemplate
                        button1
                         button2
so how do i detect which button was click. the reason i ask because you have to create new variable inroder to receive the value of the button like this

Dim

btn1 As Button = DirectCast(RadPanelBar1.FindItemByValue("Name").FindControl("btn1"), Button)

so really the server side can't see the button it self because it is burried deep in the panelbar control. could you help? thanks.

 

0
Reinhold
Top achievements
Rank 1
answered on 28 Oct 2008, 01:48 PM
Same problem with me.

any answers out there?

Regards,
Reinhold
0
Simon
Telerik team
answered on 28 Oct 2008, 02:55 PM
Hi there,

You can hook to the Click events of the Buttons in the ASPX like this:

[ASPX]
    <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server"
        </asp:ScriptManager> 
        <div> 
            <telerik:RadPanelBar ID="RadPanelBar1" runat="server"
                <CollapseAnimation Type="None" Duration="100"></CollapseAnimation> 
                <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"
                                        <ItemTemplate> 
                                            <asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button_Click" /> 
                                            <asp:Button ID="Button2" runat="server" Text="Button2" OnClick="Button_Click" /> 
                                        </ItemTemplate> 
                                    </telerik:RadPanelItem> 
                                </Items> 
                            </telerik:RadPanelItem> 
                        </Items> 
                    </telerik:RadPanelItem> 
                    <telerik:RadPanelItem runat="server" Text="Root RadPanelItem2"
                    </telerik:RadPanelItem> 
                </Items> 
                <ExpandAnimation Type="None" Duration="100"></ExpandAnimation> 
            </telerik:RadPanelBar> 
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></div
    </form> 

And here is the event handler used by both Buttons:

[ASPX.VB]
    Protected Sub Button_Click(ByVal sender As ObjectByVal e As System.EventArgs) 
        Me.Label1.Text = TryCast(sender, Button).Text 
    End Sub 

Kind regards,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
PanelBar
Asked by
appdev
Top achievements
Rank 1
Answers by
Ed
Top achievements
Rank 1
appdev
Top achievements
Rank 1
Reinhold
Top achievements
Rank 1
Simon
Telerik team
Share this question
or