I need to get a reference to a telerik control contained in the commanditemtemplate of a radgrid using javascript.
Given the following:
<CommandItemTemplate>
<asp:Table>
<asp:TableRow>
<asp:TableCell>
<telerik:RadComboBox runat=server ID="RadComboBox_CommandItem">
How would I get the reference to the ComboBox?
I've tried window.$find, $telerik.findControl and $telerik.findElement, but I keep getting a " CS0103: The name 'RadComboBox_CommandItem' does not exist in the current context"
Hello Michael,
You can obtain a reference to the controls inside the CommandItemTemplate by using the $get() command to find the Grid and then use the $telerik.findControl() method:
<script> function pageLoadHandler() { var grid = $get("<%= RadGrid1.ClientID %>"); var combo = $telerik.findControl(grid, "RadComboBox_CommandItem"); // Pass the ID of the control you want to find, which is inside the Grid var comboElement = combo.get_element(); // Get the html element of the control } Sys.Application.add_load(pageLoadHandler); </script>
I hope this helps you out.
Kind regards,
Vasko
Progress Telerik