Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > PanelBar > Get a treeview instance with JS

Answered Get a treeview instance with JS

Feed from this thread
  • Posted on Sep 25, 2009 (permalink)

    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,


    Reply

  • Answer Yana Yana admin's avatar

    Posted on Sep 26, 2009 (permalink)

    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.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > PanelBar > Get a treeview instance with JS
Related resources for "Get a treeview instance with JS"

[  ASP.NET PanelBar Features  |  Documentation  |  Demos |  Step-by-step Tutorial  ]