$Find ImageButton inside ItemTemplate

2 posts, 1 answers
  1. Richard
    Richard avatar
    63 posts
    Member since:
    Apr 2008

    Posted 03 Jun 2009 Link to this post

    Can anyone tell me why I can't find any control inside an RadToolBarButton ItemTemplate besides a Telerik Control?

    Here is my markup.
            <telerik:RadToolBarButton runat="server" Group="Filtering" Text="Filter Options" Value="Filter Options">  
                <ItemTemplate>  
                    <div style="
                    padding-left:10px; padding-right:10px; padding-top:8px;">  
                        <asp:Label ID="lblFilterName" runat="server" Text="Filter: "></asp:Label>  
                        <telerik:RadComboBox  
                            ID="comboFilterList" 
                            runat="server" 
                            AllowCustomText="true" 
                            EmptyMessage="[Enter a Filter Name...]" AutoPostBack="False" OnClientKeyPressing="clientKeyPressing"></telerik:RadComboBox>  
                        <asp:ImageButton ID="btnRun" runat="server" ImageUrl="~/Images/Regular/16x16/Symbol Green/Symbol Green Play.png" ToolTip="Run the grid filter now." />  
                        <asp:ImageButton ID="btnSave" runat="server" ImageUrl="~/Images/Disabled/16x16/Symbol Green/Symbol Green Configuration.png" ToolTip="Save Filter: enter a filter name in the textbox to enable this button." />  
                        <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/Images/Disabled/16x16/Symbol Green/Symbol Green Delete.png" ToolTip="Delete Filter: select a filter from the dropdown list to enable this button." />  
                    </div>  
                </ItemTemplate>  
            </telerik:RadToolBarButton>  
     

    Here is my JavaScript Code.  The only control it finds is the RadComboBox
        function clientKeyPressing(sender) {  
            var txt = sender.get_text();  
            var toolbar1 = $find("<%= RadToolBar1.ClientID %>");  
            var filterbutton1 = toolbar1.findItemByValue("Filter Options");  
            var btnRun = filterbutton1.findControl("btnRun");  
            var btnSave = filterbutton1.findControl("btnSave");  
            var btnDelete = filterbutton1.findControl("btnDelete");  
            var combo = filterbutton1.findControl("comboFilterList");  
        }  
     
  2. Answer
    Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 04 Jun 2009 Link to this post

    Hello Richard,

    Indeed the findControl method returns only ASP.NET Ajax controls. To find an html element you can use this code:

    var btnRun = $telerik.findElement(filterbutton1.get_element(), "btnRun");

    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. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top