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

Using RadPanelBar with bound data

3 Answers 97 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 07 May 2009, 12:03 PM
Hi I have the following aspx code and want to get the radpanelbar headers to expand and collapse. I understand you can not have this functionality when using itemtemplates in the header panel, but the examples given do not suit what I am trying to do with binding the panelbar items to a datasource as each item seems to need to be specifically setup. Could someone please explain if it is even possible to achieve this? Many thanks.

.aspx file

<

 

telerik:RadPanelBar ID="RadPanelBar1" runat="server" DataFieldID="EntityId" DataTextField="EntityId"

 

 

DataValueField="EntityId" Skin="WebBlue" DataSourceID="SubscriptionDataSource"

 

 

Width="100%" AllowCollapseAllItems="True" OnItemDataBound="RadPanelBar1_ItemDataBound"

 

 

OnInit="RadPanelBar1_Init" ExpandMode="SingleExpandedItem"

 

 

PersistStateInCookie="True" OnClientItemClicked="OnClientItemClicked">

 

 

<CollapseAnimation Type="Linear" Duration="100"></CollapseAnimation>

 

 

<ExpandAnimation Type="Linear" Duration="100"></ExpandAnimation>

 

 

<ItemTemplate>

 

 

<telerik:RadToolBar ID="RadToolBar1" runat="server" Skin="WebBlue" Width="100%" OnButtonClick="RadToolBar1_OnToolBarClick">

 

 

<CollapseAnimation Duration="200" Type="OutQuint" />

 

 

<Items>

 

 

<telerik:RadToolBarButton runat="server" Text="" ToolTip="Refresh" Value="Refresh">

 

 

</telerik:RadToolBarButton>

 

 

</Items>

 

 

</telerik:RadToolBar>

 

 

<asp:ObjectDataSource ID="FolderDataSource" runat="server" SelectMethod="GetDocumentFolderList"

 

 

TypeName="Document.DocumentPL"

 

 

OldValuesParameterFormatString="original_{0}">

 

 

<SelectParameters>

 

 

<asp:Parameter DefaultValue="1" Name="groupId" Type="Int32" />

 

 

</SelectParameters>

 

 

</asp:ObjectDataSource>

 

 

<table width="100%">

 

 

<tr>

 

 

<td width="100%">

 

 

<telerik:RadTreeView ID="RadTreeView1" runat="server" DataSourceID="FolderDataSource"

 

 

DataFieldID="DocumentFolderId" DataFieldParentID="ParentDocumentFolderId" DataTextField="Name"

 

 

DataValueField="DocumentFolderId" OnNodeClick="RadTreeView1_OnNodeClick" Height="94%"

 

 

Skin="WebBlue" EnableDragAndDrop="True" Width="100%" OnNodeDrop="RadTreeView1_NodeDrop"

 

 

MultipleSelect="True" Style="overflow-y: hidden"

 

 

onload="RadTreeView1_Load" onunload="RadTreeView1_Unload">

 

 

</telerik:RadTreeView>

 

<%

--<asp:Literal ID="Literal2" runat="server" Text='<%# Eval("DataValueField") %>' />--%>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</ItemTemplate>

 

 

</

 

telerik:RadPanelBar>

 

<

 

asp:ObjectDataSource ID="SubscriptionDataSource" runat="server" OldValuesParameterFormatString="original_{0}"

 

 

SelectMethod="GetSubscriptionList" TypeName="Subscription.SubscriptionPL">

 

 

<SelectParameters>

 

 

<asp:Parameter DefaultValue="1" Name="subscriptionType" Type="Object" />

 

 

<asp:Parameter Name="userId" Type="Int32" DefaultValue="" />

 

 

</SelectParameters>

 

</

 

asp:ObjectDataSource>

.cs file

 

 

protected void RadPanelBar1_ItemDataBound(object sender, RadPanelBarEventArgs e)

 

{

 

ObjectDataSource c = (ObjectDataSource)e.Item.FindControl("FolderDataSource");

 

c.SelectParameters[

"groupId"].DefaultValue = e.Item.Value;

 

 

RadTreeView radTreeView1 = (RadTreeView)e.Item.FindControl("RadTreeView1");

 

 

this.SortNodes(radTreeView1.Nodes);

 

radTreeView1.ExpandAllNodes();

 

RadToolBar toolbar = (RadToolBar)e.Item.FindControl("RadToolBar1");

 

}

 

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 07 May 2009, 03:08 PM
Hi Jonathan,

Unfortunately this is not supported. The ItemTemplate is used to define the contents of the panel item text. For the panel item collapsible area you need to use child items:

<telerik:RadPanelBar>
     <Items>
              <telerik:RadPanelItem Text="Header">
                       <Items>
                             <telerik:RadPanelItem>
                                     <ItemTemplate>
                                              Collapsible content goes here ...

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jonathan
Top achievements
Rank 1
answered on 08 May 2009, 04:24 PM
Hi, thanks for the response.

How would I implement the ObjectDataSource as shown in the example in the previous post to work with this way of implementing the template?

Many thanks
Jon
0
Atanas Korchev
Telerik team
answered on 11 May 2009, 09:06 AM
Hi Jonathan,

Unfortunately this is not possible. You need to use templates from codebehind and instantiate them after the panelbar is databound. You can check this help article for additional info.

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
PanelBar
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jonathan
Top achievements
Rank 1
Share this question
or