New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Accessing Controls Inside Templates

The following example demonstrates how to find RadTreeView control nested in ItemTemplate of RadComboBox.

Here follows the markup:

<telerik:radcombobox id="RadComboBox1" runat="server">    
    <telerik:RadTreeView RenderMode="Lightweight" ID="RadTreeView1" runat="server">            
        <telerik:RadTreeNode Text="Products"></telerik:RadTreeNode>                
        <telerik:RadTreeNode Text="Services"></telerik:RadTreeNode>            
    <telerik:RadComboBoxItem Text="" />    

How to find RadTreeView object server-side

You need to search for the RadTreeView in the Controls collection of the RadComboBox's item:

RadTreeView tree = (RadTreeView)RadComboBox1.Items[0].FindControl("RadTreeView1");

Dim tree As RadTreeView = DirectCast(RadComboBox1.Items(0).FindControl("RadTreeView1"), RadTreeView)

How to find RadTreeView object client-side

Here are the available options to find the RadTreeView object in RadComboBox, on the client:

var combo = $find("<%= RadComboBox1.ClientID %>");
var tree = combo.get_items().getItem(0).findControl("RadTreeView1"); 

/* OR */

var tree = $find('<%= RadComboBox1.Items[0].FindControl("RadTreeView1").ClientID %>'); 

See Also

In this article