This is a migrated thread and some comments may be shown as answers.
Get a treeview instance with JS
1 Answer 13 Views
This is a migrated thread and some comments may be shown as answers.
Web Services
Top achievements
Rank 2
Web Services asked on 25 Sep 2009, 08:34 PM
I need to get the equivalent to $find('<%=RadTreeView1.ClientID %>'); in JavaScript. The problem is my treeview is nested within a radpanelbar. Here is the code I have so far but it is not working.

            scheduler = $find('<%=RadScheduler1.ClientID %>');
            panelBar = $find('<%=RadPanelBar1.ClientID %>');
            item = panelBar.findItemByText("Events");
            treeview = item.findControl('<%=RadTreeView1.ClientID %>');

Here is the aspx of the panel bar.
<telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Web20" ExpandMode="SingleExpandedItem"
        AllowCollapseAllItems="false" Width="220px" BorderStyle="None" OnClientItemClicked="itemClicked"
            <CollapseAnimation Type="None" Duration="100"></CollapseAnimation>
                <telerik:RadPanelItem runat="server" Text="Events" Font-Bold="true" Font-Size="Medium"
                        <telerik:RadPanelItem runat="server">
                                <telerik:RadTreeView ID="RadTreeView1" runat="server" Skin="Web20" CssClass="leftPanelContent"
                                    CheckBoxes="true" OnClientNodeChecking="OnClientNodeChecked" OnClientNodeClicking="OnClientNodeClicking">


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 26 Sep 2009, 08:46 AM

Actually the treeview is not in the template of the "Events" item, but in its first child's template, so the code should be like this:

var panelBar = $find('<%=RadPanelBar1.ClientID %>'); 
var item = panelBar.findItemByText("Events"); 
var treeview = item.get_items().getItem(0).findControl("RadTreeView1"); 

Kind regards,
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Asked by
Web Services
Top achievements
Rank 2
Answers by
Telerik team
Share this question