Introduction
The TreeView IE Web control when rendered in a
visitor's browser displays a tree much like the tree in the Windows Explorer.
Specifically the TreeView consists of an arbitrary number of Tree Node objects.
Each Tree Node object can have text and an image associated with it additionally
the Tree Node can be rendered as a hyperlink and have a URL associated with it.
Each Tree Node also can have an arbitrary number of children Tree Node objects.
The hierarchy of Tree Nodes and their children constitute the makeup of the tree
rendered by the TreeView control. TreeView controls are extremely common in
applications where it is necessary to present any sort of hierarchy to a user.
Usually the nature of such a hierarchy requires that users have the ability to
reorganize it drag and drop operations providing a natural solution.
ASP.NET 2.0 introduces a new control named
TreeView that provides a seamless way to consume information from hierarchical
data sources such as an XML file and then display that information. You can use
the TreeView control to display information from a wide variety of data sources
such as an XML file site map file string or from a database.
The ASP.NET 2.0 TreeView control is a
completely new control introduced with ASP.NET 2.0 that is available under the
Standard tab in the Toolbox. You can use the TreeView control in any situation
in which you need to display hierarchical data. For example, you can use this
control when displaying a navigation menu displaying database records from
database tables in a Master/Detail relation displaying the contents of an XML
document or displaying files and folders from the file system.
Example : Simple create a TreeNodeEditor
Dialog Box.
Code
<ie:TreeView
id="tvFamilyTree"
runat="server">
<ie:TreeNode
Text="John
Smith">
<ie:TreeNode
Text="Born: Jan. 3rd,
1885"></ie:TreeNode>
<ie:TreeNode
Text="Died: Feb. 13,
1919"></ie:TreeNode>
<ie:TreeNode
Text="Spouse">
<ie:TreeNode
Text="Marie
Ellsworth">
<ie:TreeNode
Text="Born: Aug. 1,
1889"></ie:TreeNode>
<ie:TreeNode
Text="Died: Unknown"></ie:TreeNode>
</ie:TreeNode>
<ie:TreeNode
Text="Children">
<ie:TreeNode
Text="John
Smith, Jr.">
<ie:TreeNode
Text="Born: July 4,
1891"></ie:TreeNode>
<ie:TreeNode
Text="Died: Sept. 22,
1893"></ie:TreeNode>
</ie:TreeNode>
<ie:TreeNode
Text="Mary
Smith">
<ie:TreeNode
Text="Born: June 7,
1893"></ie:TreeNode>
<ie:TreeNode
Text="Died: Aug. 13,
1949"></ie:TreeNode>
<ie:TreeNode
Text="Spouse">
<ie:TreeNode
Text="Edward
Joy">
<ie:TreeNode
Text="Born: Unknown"></ie:TreeNode>
<ie:TreeNode
Text="Died:
Aug. 13,
1949"></ie:TreeNode>
</ie:TreeNode>
<ie:TreeNode
Text="Children">
<ie:TreeNode
Text="Michael
Joy">
<ie:TreeNode
Text="Born:
Oct. 8,
1918"></ie:TreeNode>
</ie:TreeNode>
<ie:TreeNode
Text="Michele
Joy">
<ie:TreeNode
Text="Born:
May 21,
1920"></ie:TreeNode>
</ie:TreeNode>
</ie:TreeNode>
</ie:TreeNode>
</ie:TreeNode>
</ie:TreeNode>
</ie:TreeNode>
</ie:TreeNode>
</ie:TreeView>