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

Problem with data binding RadPanelBar and collapse/expand its elements

1 Answer 118 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Krasimir
Top achievements
Rank 1
Krasimir asked on 22 Oct 2010, 11:23 AM
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.

1 Answer, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 27 Oct 2010, 10:53 AM
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
Tags
PanelBar
Asked by
Krasimir
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Share this question
or