Problem with get Nodes JS

2 posts, 0 answers
  1. Silvia
    Silvia avatar
    7 posts
    Member since:
    Sep 2011

    Posted 18 Oct 2011 Link to this post

    Hi,

    I need to get an array of the root nodes of my tree view, but when i try, the tree view is a divElement and the nodes indefined.
    This is my code:
    JS:
    function deshabilitarNodos(treeView, args) {
        alert("Llegue");
        var tree = <%=RadTreeView2.ClientID %>
        alert (tree);
        var nodosPrincipales= tree.Nodes;
        alert(nodosPrincipales);  // This is indefined
    }

    ASP:
    <telerik:RadTreeView ID="RadTreeView2" runat="server" Width="300px" 
                Height="900px" DataFieldID="Id" DataFieldParentID="Padre" 
                ImageUrlField ="Imagen" DataSourceID="ObjectDataSource1" 
                DataTextField="Nombre" DataValueField="Id" OnClientNodeExpanding="deshabilitarNodos" >


                <DataBindings>
                    <telerik:RadTreeNodeBinding ImageUrlField="Imagen" Expanded="false" />
                </DataBindings>
            </telerik:RadTreeView>


            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                SelectMethod="cargarSegmentos" TypeName="PL.Util.cliente">
            </asp:ObjectDataSource>

    Thanks.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Oct 2011 Link to this post

    Hello Silvia,

    You can use get_allNodes() to get the nodes of TreeView.

    JS:
    <script type="text/javascript">
    function OnClientNodeExpanding(sender, args)
    {
      var nodes = sender.get_allNodes();
    }
    </script>

    You can check the following documentation.
    Client-Side Programming Basics

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top