Problem with data binding RadPanelBar and collapse/expand its elements

2 posts, 0 answers
  1. Krasimir
    Krasimir avatar
    14 posts
    Member since:
    Feb 2009

    Posted 22 Oct 2010 Link to this post

    Hi. 

    I have a problem with the RadPanelBar when I try to bind it to an OpenAccessDataSource. I have a single level list of data that I try to bind. The problem is that when I bind the control the items are not collapsible. The markup that I use is: 

    <telerik:RadPanelBar ID="rpbContainers" runat="server" DataTextField="Name" DataSourceID="oadsContainers" DataValueField="ID" Width="100%" Skin="Windows7" ExpandMode="MultipleExpandedItems"
        AppendDataBoundItems="true" >
        <Items>
            <telerik:RadPanelItem Text="New Container" Value="-1" Expanded="true">
                <ContentTemplate>
                    Create new container
                </ContentTemplate>
            </telerik:RadPanelItem>
        </Items>
        <ItemTemplate>
            <telerik:RadPanelItem>
                <Items>
                    <telerik:RadPanelItem>
                        <ContentTemplate>
                            <%# Eval("Name") %>
                        </ContentTemplate>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelItem>
        </ItemTemplate>
    </telerik:RadPanelBar>

    I also want to have a default element binded to the PanelPar, such as in a drop down's default element. 

    Kind regards,
    Krasi.
  2. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 27 Oct 2010 Link to this post

    Hello Krasimir,

    The problem here is that RadPanelItem in not a contol. You actually can see that there is no intellisense for it, when you try to type it down outside of <items></items> clause.

    My advice would be to create the template in the code-behind as a class implementing the ITemplate interface, to handle the TemplateNeeded event of RadPanelBar and having that it's thrown for each and every item during the dataBinding process you can even decide what template to assign (if having more that one types of items).

    Here is a reference for creating the template(s): http://www.telerik.com/help/aspnet-ajax/panel_add-templates-runtime.html

    Here is a reference to the TemplateNeeded event of RadPanelBar: http://www.telerik.com/help/aspnet-ajax/telerik.web.ui-telerik.web.ui.radpanelbar-templateneeded_ev.html

    Please, let me know if the suggested worked for you!
    I hope this is helpful!


    Regards,
    Nikolay Tsenkov
    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
Back to Top