Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
|
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 8th, 2010, 05:06 PM
Registered User
 
Join Date: Feb 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Displaying a nested table in a treeview

Hello All,

I am thinking about the best way to display a nested table in a TreeView.

The table looks like this

Code, ParentCode, Description

Where ParentCode is the ID of the Code in the same table.

For example, the data would look like this

Code1, null, Call Signs
SMILE, Code1, Smiling
LAUGH, Code1, Laughing
LMAO, LAUGH, Laughing My Ass Off
Code2, null, Colors
Red, Code2, Red color
Blue, Code2, Blue


And I want to display this in a TreeView as follows

Code:
Code1 (Call Signs)
   Smile (Smiling)
   Laugh (Laughing)
      LMAO (Laughing My Ass Off)

Code2  (Colors)
   Red (Red Color)
   Blue (Blue)
I have N-Layer application. And Im considering add a .GetChildren method to the codes Manager to get all children of a code. And then go through all top items and then in depth.

But Iam worried that this will be too length, and while I will implement such a method for flexibility later on, I want to be able to do this preferably in one shot on the DB and have the DB or BLL return it in a structure that is readily useful for the TreeView.


I appreciate all the help I can get.

Last edited by SariHiari; February 8th, 2010 at 05:08 PM.. Reason: Formatting
 
Old February 8th, 2010, 05:49 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You may want to look at Common Table Expressions, that were introduced in SQL Server 2005: http://www.google.nl/#hl=nl&q=sql+se...c354cdb0d93773

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested Loops in SQL Query values from table/set miamikk SQL Server 2000 1 August 31st, 2007 12:35 AM
XSL multiple files in table (nested for-each ?) pedoublety XSLT 5 August 21st, 2007 08:00 AM
Displaying record from a look up table stecol Classic ASP Databases 2 February 1st, 2007 10:31 AM
Displaying data in a table Mike707 Dreamweaver (all versions) 1 April 19th, 2006 01:43 PM
nested sproc temp table cole SQL Language 1 June 9th, 2005 05:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.