DataBound PanelBar Won't Expand

5 posts, 0 answers
  1. Josh McCullough
    Josh McCullough avatar
    9 posts
    Member since:
    May 2010

    Posted 01 Jul 2010 Link to this post

    I've read the issue here: http://www.telerik.com/help/aspnet-ajax/panelbar-troubleshooting-root-items-collapse.html but I still can't get the root items to expand.

    My ASPX:
        <Telerik:RadPanelBar ID="panelBar" runat="server" Width="100%" ExpandMode="MultipleExpandedItems">  
            <Items> 
                <Telerik:RadPanelItem> 
                    <Items> 
                        <Telerik:RadPanelItem> 
                            <ItemTemplate> 
                                <%# Eval("ShortDefinition") %> 
                            </ItemTemplate> 
                        </Telerik:RadPanelItem> 
                    </Items> 
                </Telerik:RadPanelItem> 
            </Items> 
            <DataBindings> 
                <Telerik:RadPanelItemBinding TextField="Label" Expanded="false" /> 
            </DataBindings> 
        </Telerik:RadPanelBar> 

    My Code Behind:
    namespace MyNamespace  
    {  
        public partial class MyPage : System.Web.UI.Page  
        {  
            protected void Page_Load(object sender, EventArgs e)  
            {  
                panelBar.DataSource = new[]  
                {  
                    new { Label="One", ShortDefinition="This is #1." },  
                    new { Label="Two", ShortDefinition="This is #2." },  
                    new { Label="Three", ShortDefinition="This is #3." },  
                    new { Label="Four", ShortDefinition="This is #4." },  
                    new { Label="Five", ShortDefinition="This is #5." }  
                };  
                panelBar.DataBind();  
            }  
        }  

    This produces a list of PanelItems (One, Two, etc.) but they are not expandable and there is no content.

    Thanks!
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 05 Jul 2010 Link to this post

    Hi Josh McCullough,

    You cannot set templates like this,  because you also create declaratively items which are lost after the panelbar is databound. I've attached a modified version of your code to demonstrate how to achieve the needed approach. If you need a more complicated template, you should create it in the code behind.
    Please try the attached file and let us know what you think.

    Greetings,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Josh McCullough
    Josh McCullough avatar
    9 posts
    Member since:
    May 2010

    Posted 05 Jul 2010 Link to this post

    Thanks for posting a possible solution, However, in my case the contents will be much more complex so this won't work for me. Your solution of just adding the controls via code-behind doesn't feel right, either. I wish there was a better way to do what I need to do - but I just ended up writing a simple CollapsiblePanel control to use instead of the PanelBar in this case.

    Thanks.
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 08 Jul 2010 Link to this post

    Hello Josh ,

    I'm sorry that the panelbar didn't meet your requirements.

    RadPanelBar will provide a new content template from Q2 2010 release. It will be available next week, so you can check it out.

    Best regards,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Josh McCullough
    Josh McCullough avatar
    9 posts
    Member since:
    May 2010

    Posted 08 Jul 2010 Link to this post

    I look forward to checking it out, thank you!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017