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

More than one expand item

2 Answers 59 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Iron
Daniel asked on 25 Jan 2010, 02:16 AM
Hi. Is it possible to have more than one expand item per panel item? Example, say I have a RadPanelBar with three RadPanelItems named Cars, Trucks and Buses. Next to Cars I would like a LinkButton that reads "New" and next to that "Used". So, clicking on the default "Cars" would display all the cars, the "New" would list just new cars and "Used" would display used cars. How would I pass onto a RadMultiPage what the user has clicked? Thanks.

Daniel

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 25 Jan 2010, 12:14 PM
Hello Daniel,

One suggestion would be setting the value for the sub panelbaritems accordingly and set the visibility of those on clicking the Linkbutton. Here is the example. Give a try with this and see whether it suits your need.

aspx:
 
<telerik:RadPanelBar runat="server" ID="RadPanelBar3" ExpandMode="SingleExpandedItem"
    <Items> 
        <telerik:RadPanelItem Text="Car" Value="Car" runat="server"
            <ItemTemplate> 
                <asp:LinkButton ID="LinkButton1" Text="Used" runat="server" OnClick="LinkButton1_Click"></asp:LinkButton> 
                <asp:LinkButton ID="LinkButton2" Text="New" runat="server" OnClick="LinkButton2_Click"></asp:LinkButton> 
            </ItemTemplate> 
            <Items> 
                <telerik:RadPanelItem Text="C1" Value="used"
                </telerik:RadPanelItem> 
                <telerik:RadPanelItem Text="C2" Value="used"
                </telerik:RadPanelItem> 
                <telerik:RadPanelItem Text="C3" Value="new"
                </telerik:RadPanelItem> 
            </Items> 
        </telerik:RadPanelItem> 
        . . . 
    </Items> 
</telerik:RadPanelBar> 

cs:
 
 
protected void LinkButton1_Click(object sender, EventArgs e) 
    LinkButton lnkbutton = (LinkButton) sender; 
    RadPanelItem Pitem = (RadPanelItem)lnkbutton.NamingContainer; 
 
    foreach (RadPanelItem item in Pitem.Items) 
    { 
        if (item.Value == "used"
        { 
            item.Visible = false
        } 
        else 
            item.Visible = true
    } 
    Pitem.Expanded = true
    string clickeedItem = lnkbutton.Text; 
    Response.Write(clickeedItem); 
 
 
protected void LinkButton2_Click(object sender, EventArgs e) 
    LinkButton lnkbutton = (LinkButton)sender; 
    RadPanelItem Pitem = (RadPanelItem)lnkbutton.NamingContainer; 
 
    foreach (RadPanelItem item in Pitem.Items) 
    { 
        if (item.Value == "new"
        { 
            item.Visible = false
        } 
        else 
            item.Visible = true
    } 
    Pitem.Expanded = true
 
    string clickeedItem = lnkbutton.Text; 
    Response.Write(clickeedItem); 

-Shinu.
0
Daniel
Top achievements
Rank 1
Iron
answered on 28 Jan 2010, 04:35 AM
Thanks Shinu. I used that code and it worked with my app. Thanks.

Daniel
Tags
PanelBar
Asked by
Daniel
Top achievements
Rank 1
Iron
Answers by
Shinu
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Iron
Share this question
or