More than one expand item

3 posts, 1 answers
  1. Daniel
    Daniel avatar
    175 posts
    Member since:
    Feb 2009

    Posted 24 Jan 2010 Link to this post

    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. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Jan 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel
    Daniel avatar
    175 posts
    Member since:
    Feb 2009

    Posted 27 Jan 2010 Link to this post

    Thanks Shinu. I used that code and it worked with my app. Thanks.

    Daniel
Back to Top