Accessing treeNode attributes in javascript

2 posts, 0 answers
  1. James
    James avatar
    5 posts
    Member since:
    Apr 2009

    Posted 13 May 2009 Link to this post

    Is there a doc anywhere that lists all the treeNode get methods? Basically I need to pull an attribute out of the selected node and I have been unable to get to it. The only things that seem to work are get_text() and get_value(). Neither of which help me.

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

    Posted 15 May 2009 Link to this post

    Hello James,

    You can use the get_attributes() method of RadTreeNode object to get the collection of all custom attributes set to the Node. See the example shown below:

    <telerik:RadTreeView ID="RadTreeView1"  runat="server" OnClientNodeClicked="onNodeClicked">  
           <telerik:RadTreeNode runat="server" Text="BMW" CategoryOf="Car">  
           <telerik:RadTreeNode runat="server" Text="Red" CategoryOf="Color">  
           <telerik:RadTreeNode runat="server" Text="Mango" CategoryOf="Fruit">  

    <script language="javascript" type="text/javascript">  
     function onNodeClicked(sender, args)  
       var node = args.get_node();  
       //you can also set attributes, like:  

    Go through the following link which lists the most important functions of the RadTreeNode object.

Back to Top