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"
            Height="500px">
            <CollapseAnimation Type="None" Duration="100"></CollapseAnimation>
            <Items>
                <telerik:RadPanelItem runat="server" Text="Events" Font-Bold="true" Font-Size="Medium"
                    Expanded="true">
                    <Items>
                        <telerik:RadPanelItem runat="server">
                            <ItemTemplate>
                                <telerik:RadTreeView ID="RadTreeView1" runat="server" Skin="Web20" CssClass="leftPanelContent"
                                    CheckBoxes="true" OnClientNodeChecking="OnClientNodeChecked" OnClientNodeClicking="OnClientNodeClicking">
                                </telerik:RadTreeView>
                            </ItemTemplate>
                        </telerik:RadPanelItem>
                    </Items>
                </telerik:RadPanelItem>

Thanks,


1 Answer, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 26 Sep 2009, 08:46 AM
Hello,

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,
Yana
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
Yana
Telerik team
Share this question
or