After much pain and agony with RadPanelBar and user controls, I'm trying a different approach in using ItemTemplates for the Panel bar items with databinding to a custom object collection. Now I'm having problems collapsing the different items. I know that I cannot collapse root items and have tried to follow your examples on how structure my panel bar properly to allow for collapse/expand but I cannot find any documentation in regards to data-bound panel bars.. and I cannot spend anymore time on this one little part of my website.
Here's my markup, designed per http://www.telerik.com/help/aspnet-ajax/panelbar-troubleshooting-root-items-collapse.html:
| <telerik:RadPanelBar ID="radPanelBarAccountList" Runat="server" Height="200%" |
| Width="100%" Skin="Vista" AllowCollapseAllItems="True"> |
| <Items> |
| <telerik:RadPanelItem runat="server" Text="Replace With Account Name"> |
| <Items> |
| <telerik:RadPanelItem> |
| <ItemTemplate> |
| <UC1:AccountInfo ID="AccountInfo1" runat="server" AccountID='<%# DataBinder.Eval(Container.DataItem, "Id") %>' /> |
| </ItemTemplate> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelBar> |
Here's my databinding in code behind:
| 'Get collection of accounts |
| Dim accountCollection As Collection(Of FIAccount) |
| Dim accountsPresenter = New AccountsPresenter(New Guid(Session("SubscriberId").ToString), BasePage.GetCultureName.ToString()) |
| accountCollection = accountsPresenter.GetAccounts("Actual", False, Account.AccountStatus.All) |
| 'Bind panel bar |
| With radPanelBarAccountList |
| .DataSource = accountCollection.ToList |
| .DataTextField = "Name" |
| .DataValueField = "Id" |
| .DataBind() |
| End With |
The root items are displaying my account names, as expected, but I cannot expand them to see the user control inside. I initially defined the markup without any nested items, with the user control defined as an ItemTemplate, and it rendered correclty but I couldn't collapse the items.
This is kinda crazy! I can't believe I have to nest so many panel bar items just to get this working properly but if that's how I have to do it, can you give me a code-behind sample on how to bind the individual items so I can display the text value on the child panel items, instead of the root panel item, so I can collapse/expand it? Or is there a javascript function I can wire up on item click or something? Like I said, I cannot spend much more time on this and I use this RadPanelBar all over my site!!!
Please Help!!!