Using RadPanelBar with bound data

4 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    4 posts
    Member since:
    Oct 2008

    Posted 07 May 2009 Link to this post

    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");

     

    }

     

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 07 May 2009 Link to this post

    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.
  3. Jonathan
    Jonathan avatar
    4 posts
    Member since:
    Oct 2008

    Posted 08 May 2009 Link to this post

    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
  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 11 May 2009 Link to this post

    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.
Back to Top