Click here to Skip to main content
15,892,298 members
Articles / Web Development / ASP.NET

Creating a highly manageable TreeView control using Microsoft Web TreeView control

Rate me:
Please Sign up or sign in to vote.
4.46/5 (15 votes)
20 Sep 2005CPOL4 min read 144.3K   3.7K   62  
An atricle on how to implement a manageable treeview architecture.
using System;
using System.Xml;
using System.IO;

// user defined
using TreeView.Framework.Interface;
using System.Collections;
using TreeView.Objects;

namespace TreeView.Objects.Provider
{
	/// <summary>
	/// Summary description for CompanyProvider.
	/// </summary>
	public class CompanyProvider: IProvider
	{
		private ArrayList _List;
	
	
		#region IProvider Members

		public IList GetAll(int parentID)
		{
			_List = new ArrayList();
			// create the objects
			
			XmlDocument doc = new XmlDocument();
			
			string filePath = System.AppDomain.CurrentDomain.BaseDirectory +"Data.xml";
			doc.Load( filePath  );

			XmlNodeList nodeList = doc.GetElementsByTagName( "company" );
	
			foreach ( XmlNode node in nodeList )
			{
				int ID = Convert.ToInt32(  node.Attributes[ "id" ].Value );
				string name = node.Attributes[ "name" ].Value;
				// create a new company
				Company company = new Company( ID, name );
				
				_List.Add( company );
			}

			return _List;
		}

		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Telerik Corporation
Bangladesh Bangladesh
Passionate about cutting edge technologies and a .net enthusiast. I have played roles in variety of products starting from University automation to web 2.0 start-page (www.pageflakes.com).

Currently, working at Telerik Inc (www.telerik.com), the premium rad control provider for asp.net and winforms. I am a active contributor and member at www.dotnetslackers.com. In addition, i do a frequent post on my blog about LINQ, C#, Asp.net and about my projects.

I am Microsoft MVP. I love to travel and meet cool people.

Comments and Discussions