Overview
It is not always possible to provide all properties that might be needed for a given scenario. The RadTreeNode object provides a special collection called Attributes that can store any number of name and value pairs.
The custom attribute's name should not be an HTML reserved word. Please see this articlefor more information.
-
Attributes can be defined declaratively by simply adding HTML attributes to a RadTreeNode tag.
-
To add an attribute at runtime on the server, use the Add() method of the RadTreeNode Attributes object passing a key string and a value string.
RadTreeNode root1 = new RadTreeNode("root1");
root1.Attributes.Add("My Key", "My Value");
RadTreeView1.Nodes.Add(root1);
-
Attributes can be accessed in server-side code by addressing the RadTreeNode Attributes collection.
-
Attributes can be accessed in client-side code using the getAttributes() function. See also the Custom Attributes online demo for another example.
-
Attributes can be used to locate nodes using the RadTreeView's or RadTreeView.Nodes's FindNodeByAttribute() method. Also see the Tutorial: Finding Nodes topic.