Cannot find controls inside ItemTemplate of RadPanelBar

3 posts, 0 answers
  1. Covertix
    Covertix avatar
    96 posts
    Member since:
    Aug 2008

    Posted 03 May 2012 Link to this post


    I have a RadPanelBar, and I can't find controls inside the ItemTemplate.
    I read:Help documentation for accessing item: Accessing Items
    Help documentation for accessing control inside: Accessing Controls Inside Templates
    But it doesn't work for me.

    here is my code:


    <telerik:RadPanelBar ID="rpbAddFilters" runat="server">


            <telerik:RadPanelItem Text="RadPanelItem" runat="server">


                    <telerik:RadPanelItem Value="test" runat="server">


                            <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">


                                            <asp:Panel ID="pnlValues" runat="server">


                                    `       </asp:Panel>


                    </telerik:RadPanelItem >
             </telerik:RadPanelItem >



    function find()

        var panelbar = $find("<%= rpbAddFilters.ClientID %>");



        var item = panelbar.findItemByValue("test");

        var pnlValues = item.findControl("pnlValues");


    I get null value for pnlValues.

  2. Vuyiswa
    Vuyiswa avatar
    223 posts
    Member since:
    Jan 2010

    Posted 04 May 2012 Link to this post

    Ok i dont have an Example for javascript but i cant show you how you can do it on the server side. So in my case i have a "ReportViewer" inside the item so the following code finds the REportviewer inside an itemtemplate

    Dim RadPanelBar1 As RadPanelBar = CType(sender, RadPanelBar)
                    Dim InnerPanel As RadPanelItem = CType(RadPanelBar1.FindItemByValue("Impairment"), RadPanelItem)
                    Dim rptreportviewer As Microsoft.Reporting.WebForms.ReportViewer = CType(InnerPanel.FindControl("rptImpairment"), Microsoft.Reporting.WebForms.ReportViewer)

                 So look at the Value option, i use that to find the control inside the ItemTemplate 

      <telerik:RadPanelBar ID="RadPanelBar1" runat="server" ExpandMode="FullExpandedItem"
          Height="500px" Skin="Hay" Width="862px">
    <telerik:RadPanelItem    Text="Impairment">
                      <telerik:RadPanelItem Value="Impairment">
                              <rsweb:ReportViewer Width="100%" Height="500px" ID="rptImpairment" runat="server">
  3. Peter
    Peter avatar
    6637 posts

    Posted 07 May 2012 Link to this post

    Hi Tzach,

    To access nested controls client-side, you need to be sure that the control in question has a client  side object. Most Telerik RadControls for ASP.NET AJAX have a client object, but the standard ASP Panel does not have a client object hence the error that you have experienced.

    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top