Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Saturday, September 02, 2006

Using the TreeView Control and a DataList to Create an Online Image Gallery


The TreeView control, when viewed through a browser.Introduction
ASP.NET version 2.0 includes a wide array of Web controls not found in previous versions. One such control is the TreeView, which is ideal for displaying hierarchical data. The TreeView control can be bound to a hierarchical data source such as the XmlDataSource or SiteMapDataSource, or can be constructed programmatically. (For an example of using the TreeView to display a site map using the SiteMapDataSource, check out the Examining ASP.NET 2.0's Site Navigation article series.)

One common source of hierarchical data is the web server's file system. In many scenarios, there may be a folder that contains subfolders and files that the user needs to be able to browse. Using the classes in the System.IO namespace, we can programmatically populate the TreeView with the directory structure of our website. Then, when the user clicks a folder, the selected folder's files can be displayed. Continue…

Post a Comment