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

$Find ImageButton inside ItemTemplate

1 Answer 95 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Richard asked on 03 Jun 2009, 01:49 PM
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");  
    }  
 

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 04 Jun 2009, 07:48 AM
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.
Tags
ToolBar
Asked by
Richard
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Share this question
or