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

Retrive a nodes attributes fails

1 Answer 42 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 27 May 2009, 01:32 PM
I am using the following script to try to access the nodes attributes but I get an error get_attributes is not a function. When I check the node in fire bug the is defiantly no get attributes function where am I going wrong?
function onNodeClicked(sender, args)   
 {   
   var node = args.get_node();   
   alert(node.get_attributes().getAttribute("CategoryOf"));   
   //you can also set attributes, like:   
   //node.get_attributes().setAttribute("CategoryOf");   
 }   

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 27 May 2009, 01:39 PM
Hello Andrew,

I could not reproduce the problem in a simple scenario:

<telerik:RadTreeView ID="RadTreeView1" runat="server" OnClientNodeClicked="onNodeClicked"
    <Nodes> 
        <telerik:RadTreeNode Text="root" CategoryOf="my custom attribute"
        </telerik:RadTreeNode> 
    </Nodes> 
</telerik:RadTreeView> 
         
         
<script type="text/javascript"
function onNodeClicked(sender, args) 
    var node = args.get_node();    
    alert(node.get_attributes().getAttribute("CategoryOf")); 
</script> 

Can you tell us what is different in your case?

Greetings,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Andrew
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or