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

Implementing IHierarchy Support Into Your Custom Collections

Rate me:
Please Sign up or sign in to vote.
4.85/5 (25 votes)
17 Jul 20073 min read 157.8K   1.9K   67  
Brief walk-through on decorating your custom collections with the IHierarchy family of interfaces to support databinding.
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>IHierarchicalEnumerable Example 1</title>
    <style>
		body, td { font-family: Arial; font-size: 0.9em; }
		h1 { color: #999999; font-size: 1.4em; margin-bottom: 5pt; }
		h2 { color: #666666; font-size: 1.2em; margin-bottom: 5pt; }
		h3 { color: #333333; font-size: 1.1em; margin-bottom: 0pt; }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>

   		<table>
   			<tr>	
   				<td colspan="2">
			   		<h1>IHierarchicalEnumerable Example</h1>
   				</td>
   			</tr>
   			<tr>
   				<td colspan="2">
			   		<h2>Using Code Behind DataBind() Method.</h2>
   				</td>
   			</tr>
   			<tr>
   				<td valign="top" width="225px">
   					<h3>Tree View</h3>
					<asp:TreeView ID="uxTreeView" runat="server" 
						OnSelectedNodeChanged="uxTreeView_SelectedNodeChanged"
						ExpandDepth="0" ImageSet="Simple" NodeIndent="10" Width="225px" >
						<ParentNodeStyle Font-Bold="False" />
						<HoverNodeStyle Font-Underline="True" ForeColor="#DD5555" />
						<SelectedNodeStyle Font-Underline="True" ForeColor="#DD5555" HorizontalPadding="0px"
							VerticalPadding="0px" />
						<NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="0px"
							NodeSpacing="0px" VerticalPadding="0px" />
					</asp:TreeView>
   				</td>
   				<td valign="top">
   					<h3>Selection:</h3>
   					<b>Path:</b> <asp:Label ID="uxOutputPath" runat="server" /><br />
   					<b>Text:</b> <asp:Label ID="uxOutputText" runat="server" /><br />
   				</td>
   			</tr>
   		</table>
		
    </div>
    </form>
</body>
</html>

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
Scott Piegdon works full time as a Director of Quality Control for a software development company specializing Credit Union Member Services. He has experience as a Vice President of Information Technologies for a hosted ERP (Enterprise Resource Planning) company. He also runs a Web Design Services company (http://www.simplifyitwebdesign.com). He has a beautiful and wonderful wife, and two fantastic children. He loves to develop applications that others find not only easy to use and pleasing to the eye, but also provide un-surpassing functionality. He has been developing websites for over 12 years, and programming professionally for 9 of them. He has worked with dozens of database, scripting, procedural and compiled languages over the years, most recently specializing in Microsoft.Net C# 2.0 with ASP.Net backed by SQL Server 2005.

"Hopefully I can pass along some of the insight and knowledge I have acquired over the years to those curious enough to read it." - Scott Piegdon

Comments and Discussions