Retrive a nodes attributes fails

2 posts, 0 answers
  1. Andrew
    Andrew avatar
    3 posts
    Member since:
    Apr 2009

    Posted 27 May 2009 Link to this post

    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");   
     }   
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 27 May 2009 Link to this post

    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.
Back to Top