Home » Programming » Languages » Story Details
Printable Version

TreeView in ASP.NET

by Manish Tewatia on Feb 19, 2012

The TreeView IE Web control, when rendered in a visitor's browser displays a tree much like the tree in the Windows Explorer.
Comments: 0    Views: 201

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>

 

Post a Comment
*
DevExpress PowerBuilder Web Development Windows Development Languages Software Engineering Databases
iPhone Architecture Secutiry UML & Modeling Operating Systems Networking Testing
Graphics Design Project Management Hardware Open Source Games Development Business Intelligence Visual Studio LightSwitch 2011
MonoDevelop Visual Studio 2010 ASP.NET HTML, DHTML XML PHP JavaScript
Silverlight Web Services WCF Windows Forms WPF Windows Services Dynamic Link Libraries
ActiveX COM, DCOM, ATL C# VB.NET C++ F# Java
Pascal SQL Server Oracle DB2 MS-Access Windows Servers Windows
Linux Unix SAP LINQ .NET Framework ADO.NET Reporting
Crystal Reports SQL Server Reporting Services Igenda Reports Active Reports Adobe Fireworks Arrays & Collections Hosting
Future Trends Android Windows Phone Smart Devices Business M&A Investment & Funding
Web Browsers Internet Explorer Firefox Safari Common Entrepreneurs Students
Consulting Wiki Gadgets MobileMe iCloud iOS Social Media
Facebook Twitter LinkedIn Google+ Microsoft Kinect XBox
Wii Playstation DirectX i OS OS X CIO, CTO, CEO Windows 8
Web Design Expression Blend 4 Photoshop CS5 Creative Suite 5.5 Expression Web 4 Expression Studio 4 Creative Suite® 5.5 Design
Creative Suite 5.5 Web Creative Suite 5.5 Production Startups Funding M&A Laptops Smart Phones
Desktops Cameras & Camcorders Netbooks Tablets Virtualization Microsoft Surface WordPress
Software Products Cloud Computing Current Affairs Technology TV TV
Earnings XAML E-Commerce MonoTouch Mono for Android Deals Electronics
Mobile Phone Laptop Tablet Book Computer Press Releases Reviews
Products Books Companies Windows Azure SQL Azure Interviews Mac
Web Browsers Symbian Windows Forms WPF Windows Services HTML 5 Office 365
SharePoint 2010 Exchange Server Adobe Visual Studio 2012 iPad Flex / Flash Games
Windows 9
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id / Email:
Password:  
Forgot Password | Forgot UserName