Get selected node with javascript

3 posts, 0 answers
  1. archimede
    archimede avatar
    103 posts
    Member since:
    Jul 2006

    Posted 07 Oct 2010 Link to this post


    I create a TreeView  with this code:





    telerik:RadTreeView ID="rtvLineeBeni" Runat="server" OnNodeExpand="RTV_NodeExpand"


    Font-Names="Arial" Font-Size="12pt" Font-Strikeout="False" Skin="WebBlue"


    BorderColor="Gray" Height="390px" Width="748px" AllowNodeEditing="true"




    onnodeedit="rtvLineeBeni_NodeEdit" >






    <telerik:RadTreeNode Value="1" ImageUrl="~/Images/ImagesTree/Reparto.png"


    AllowEdit="false" Text="Reparto" Expanded="true" ContextMenuID="MainContextMenuInsert" >  











    Then i populate it ON DEMAND(c# code)

    How can i get the selected node with javascript ?
    I try this:





    var oId = document.getElementById('<%=rtvLineeBeni.ClientID %>').value

    var oId = document.getElementById('<%=rtvLineeBeni.ClientID %>_SelectedNode').value

    but it tells me that it's Undefined ...

    Thanks !



  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Oct 2010 Link to this post


    You need to use $find() method to get the client object of ajax enabled controls.
                 var tree = $find("<%= RadTreeView1.ClientID %>");

    Now use the get_selectedNode() method to get the selected node. The documentation shows most important client side methods of RadTreeview.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. archimede
    archimede avatar
    103 posts
    Member since:
    Jul 2006

    Posted 11 Oct 2010 Link to this post

    Thak you It helps me a lot. !!
Back to Top