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

ExpandMode="SingleExpandedItem" with always expanded RadItem

2 Answers 123 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Achim
Top achievements
Rank 1
Achim asked on 29 Sep 2009, 03:38 PM
Hello

i am trying to make a RadPanelBar with a behaviour like with ExpandMode="SingleExpandedItem" for all items except the last..
So the last RadItem should always be expanded and the other RadItems should behave like with SingleExpandedItem mode.
Can you please tell me if this possible?

Thanks
Achim

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Sep 2009, 07:49 AM
Hi Achim,

I have achieved same bahaviour by setting the ExpandMode="SingleExpandedItem" for RadPanelBar and by setting the properties  Expanded="True" and PreventCollapse="True" for last RadPanelbarItem. Give a try with following code:

ASPX:
 
<telerik:RadPanelBar ID="RadPanelBar1" runat="server" ExpandMode="SingleExpandedItem"
    <Items> 
        . . . 
        <telerik:RadPanelItem runat="server" Expanded="True" PreventCollapse="True" Text="Last Root RadPanelItem"
            <Items> 
               . . . 
            </Items> 
        </telerik:RadPanelItem> 
    </Items> 
</telerik:RadPanelBar> 

-Shinu.
0
Achim
Top achievements
Rank 1
answered on 30 Sep 2009, 02:53 PM
Hi Shinu,

thanks for the solution how to do this, glad to not have to write any javascript for this.
In my situation i have bound the RadPanelBar to a XmlSitemapProvider and have no hardcoded RadItems..
So i tried to set the properties in codebehind in various events like ItemDataBound-Event with code like:
    protected void RadPanelbar1_ItemCreated(object sender, Telerik.Web.UI.RadPanelBarEventArgs e) 
    { 
        if (e.Item.Text.ToLower().Trim().Equals("last item"))
        { 
            e.Item.Expanded = true
            e.Item.PreventCollapse = true
        } 
    }

Now problem here is on first load the item dont get expanded... I can expand it client-side and it keeps expanded while expanding/collapsing other items.. But as soon i do a full postback it will be collapsed again like on first load...
i am thinking of small javascript to expand client side after postback, but want to ask first if you have better idea?

Thanks
Achim
Tags
PanelBar
Asked by
Achim
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Achim
Top achievements
Rank 1
Share this question
or