capture node text and level through javascript

2 posts, 0 answers
  1. Michael
    Michael avatar
    1 posts
    Member since:
    Oct 2008

    Posted 27 Oct 2008 Link to this post

    Hello all. I am trying to find a way, if possible, to capture the checked node's text through javascript when the node is checked. Also I would like to be able to capture the text of the children or parent nodes to the checked node if possible. Is there anyway to get this to function through javascript? Any help would be much appreciated.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Oct 2008 Link to this post

    Hi,

    1.Try the following code snippet to access the cheked node text.

    ASPX:
    <telerik:RadTreeView ID="RadTreeView1"  runat="server"  CheckBoxes="true" OnClientNodeChecked="OnClientNodeChecked" > 

    JS:
    <script type="text/javascript" language="javascript" > 
     
       function OnClientNodeChecked(sender, eventArgs ) 
        { 
          var node = eventArgs.get_node();  
          var nodetxt=node.get_textElement().innerHTML; 
      
        } 
    </script> 

    2. Code snippet to get checked node's Parent node text.

    JS:
    function OnClientNodeChecked(sender, eventArgs ) 
     var node = eventArgs.get_node();  
     var nodetxt= node.get_parent().get_textElement().innerHTML; 
      
     } 


    Thanks
    Shinu.
Back to Top