This is a migrated thread and some comments may be shown as answers.

capture node text and level through javascript

1 Answer 51 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 27 Oct 2008, 07:26 PM
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.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Oct 2008, 05:27 AM
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.
Tags
TreeView
Asked by
Michael
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or