I want to display a hierarchical listing of items from a database
table, where, say, each row in the table has an "ID" field and a
"parent_id" field giving the ID of its parent (NULL if it's at the top
level of the hierarchy) -- like message posts and their replies. Is
there a built-in way to do this, or a generally accepted simplest way?
My first idea was to create a user control like HierarchicalLis ting
that contains a Repeater, and the repeater's ItemTemplate would itself
contain an instance of HierarchicalLis ting. Then when putting the
HierarchicalLis ting on the page, you set its DataSource and have it
query for all rows where the parent_id is null, and databind the
Repeater to the results -- and then inside the Repeater, look at the
ID of the current row, and for the HierarchicalLis ting inside the
Repeater, have it query for all rows where the parent_id was equal to
that ID. That would give you a hierarchical listing of all the rows,
if ASP.Net allowed it.
Unfortunately if you try adding
<%@ Register TagPrefix="uc1" TagName="Hierar chicalPostListi ng"
Src="Hierarchic alPostListing.a scx" %>
to the top of HierarchicalPos tListing.ascx itself, you get a run-time
error that circular file references are not allowed.
So, is there a way for a user control to be nested inside itself (or
rather, to be nested conditionally inside itself, so you don't get an
infinite recursion)? More importantly, is there a generally accepted
way to do a hierarchical listing like what I'm trying to do?
-Bennett 3 2043
Perhaps what your looking for is a TreeView..
"Bennett Haselton" <be*****@peacef ire.org> wrote in message
news:e6******** *************** **@posting.goog le.com... I want to display a hierarchical listing of items from a database table, where, say, each row in the table has an "ID" field and a "parent_id" field giving the ID of its parent (NULL if it's at the top level of the hierarchy) -- like message posts and their replies. Is there a built-in way to do this, or a generally accepted simplest way?
My first idea was to create a user control like HierarchicalLis ting that contains a Repeater, and the repeater's ItemTemplate would itself contain an instance of HierarchicalLis ting. Then when putting the HierarchicalLis ting on the page, you set its DataSource and have it query for all rows where the parent_id is null, and databind the Repeater to the results -- and then inside the Repeater, look at the ID of the current row, and for the HierarchicalLis ting inside the Repeater, have it query for all rows where the parent_id was equal to that ID. That would give you a hierarchical listing of all the rows, if ASP.Net allowed it.
Unfortunately if you try adding <%@ Register TagPrefix="uc1" TagName="Hierar chicalPostListi ng" Src="Hierarchic alPostListing.a scx" %> to the top of HierarchicalPos tListing.ascx itself, you get a run-time error that circular file references are not allowed.
So, is there a way for a user control to be nested inside itself (or rather, to be nested conditionally inside itself, so you don't get an infinite recursion)? More importantly, is there a generally accepted way to do a hierarchical listing like what I'm trying to do?
-Bennett
Hi Bennett:
I've done something similar previously. You might be interested in the
following:
Data Visualization Components http://research.microsoft.com/resear...s/default.aspx
(About 1/3 the way down the screen).
Visualization Components for Persistent Conversations http://research.microsoft.com/resear...0Report&id=407
--
Scott http://www.OdeToCode.com
On 27 Sep 2004 10:50:26 -0700, be*****@peacefi re.org (Bennett
Haselton) wrote: I want to display a hierarchical listing of items from a database table, where, say, each row in the table has an "ID" field and a "parent_id" field giving the ID of its parent (NULL if it's at the top level of the hierarchy) -- like message posts and their replies. Is there a built-in way to do this, or a generally accepted simplest way?
My first idea was to create a user control like HierarchicalLis ting that contains a Repeater, and the repeater's ItemTemplate would itself contain an instance of HierarchicalLis ting. Then when putting the HierarchicalLi sting on the page, you set its DataSource and have it query for all rows where the parent_id is null, and databind the Repeater to the results -- and then inside the Repeater, look at the ID of the current row, and for the HierarchicalLis ting inside the Repeater, have it query for all rows where the parent_id was equal to that ID. That would give you a hierarchical listing of all the rows, if ASP.Net allowed it.
Unfortunatel y if you try adding <%@ Register TagPrefix="uc1" TagName="Hierar chicalPostListi ng" Src="Hierarchi calPostListing. ascx" %> to the top of HierarchicalPos tListing.ascx itself, you get a run-time error that circular file references are not allowed.
So, is there a way for a user control to be nested inside itself (or rather, to be nested conditionally inside itself, so you don't get an infinite recursion)? More importantly, is there a generally accepted way to do a hierarchical listing like what I'm trying to do?
-Bennett
I thought I remembered something about a "TreeView" control and I tried
looking it up before coming up with my approach, but when I searched in
the MSDN index with the ".NET Framework" filter set, it only showed the
Windows Forms TreeView control. Then when I removed that filter, I did
find the Microsoft.Web.U I.WebControls.T reeView control.
However, http://msdn.microsoft.com/library/de...p/webcontrols/
overview/overview.asp says that the controls in that namespace "deliver
content that renders in all commonly used browsers, while taking
advantage of powerful features supported by Internet Explorer 5.5 or
later versions". Now I'm really confused:
If they work in all browsers, then why do they get their own namespace,
where they're officially unsupported and Visual Studio .Net has no
built-in support for them?
And if they don't work in all browsers, then I can't use those anyway.
Anyway, http://msdn.microsoft.com/library/de...p/webcontrols/
overview/overview.asp makes it look like the TreeView is for
hierarchical views that needs to be expandable and collapsable, which is
why it requires fancy tricks like client-side scripting and DHTML.
That's overkill for what I want to do; I just need a hierarchical view
that doesn't need to change.
-Bennett
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Reimar Bauer |
last post by:
Hi all,
I would like to use a hierarchical group oriented encryption.
Is there something implemented or did you know something I could use?
For explanaition.
If you have a large building there are several keys available.
Each person has a key to open his/her room. Probably this key is able to
open rooms of the group of this person.
|
by: ALEX KLEIN |
last post by:
I want to use fabricated hierarchical recordset in VB6 using ADO. I wrote
code like
dim rs as adodb.recordest
set rs=new adodb.recordest
rs.fields.append "a1",adChar,30
Then in loop I put
rs.addnew
rs("a1")=...
re.update
when I associated this with hierarchical flexgrid I saw what I expected. On
|
by: John |
last post by:
Hi,
We have XML files (and its XSD) that are dump of our tree-like data
structure in memory. These XML files may potentially have unlimited
levels of nesting because some elements can contain themselves
(recursively defined).
We want to build some reports using some third party reporting tool
(Crystal Report, for example).
|
by: Anton.Nikiforov |
last post by:
Hello everybody!
Does someone know how to build hierarchical queries to the postgresql?
I have a table with tree in it (id, parent)
and need to find a way from any point of the tree to any other point.
And i would like to have a list of all steps from point A to point B
to make some changes on each step (this is required by the algorythm).
Here is an example:
|
by: jayson_13 |
last post by:
Hi,
I want to retrieve the hierarchical structure which is store inside
the database and then display it using treeview control. But now I
got a design issue which I hope that you guys can help me. My
hierarchical structure has five levels which is store in table call
level1, level2,… level5. Each level remember the parent ID e.g. level5
contains a column called level4ID. How should I implement it in order
to get fastest loading?...
| |
by: clintonG |
last post by:
I'm looking for documentation and would not turn my nose up to
any code from anybody who thinks they are good at the design
of an algorythm that can be used to generated a hierarchical relational
data model.
What?
A Yahoo-like drill-down menu that is a series of categories and nested
categories is a hierarchical relational data model. An example can
be seen at but the review of the query string values strongly indicates
|
by: Darian |
last post by:
Is there a way to find all the thread names that are running in a
project?
For example, if I have 5 threads T1, T2, T3, T4, T5...and T2, T4, and
T5 are running...I want to be able to know that T2, T4 and T5 are
already running.
Thanks,
Darian
|
by: Juuso Hukkanen |
last post by:
I need a list of multithreading unsafe C (C99) functions/features.
comp.programming.threads provided an initial list of C:ish functions,
with following ANSI C functions:
asctime, gmtime, localtime, ctime, tmpnam, strtok
http://www.lambdacs.com/cpt/FAQ.html#Q150
However, extra Googling hinted rand() and srand(), also being
unsuitable for multi-threading - opinions? And what is the status of
|
by: Neil |
last post by:
I received a message in another newsgroup saying that I shouldn't top-post
my replies. I always top-post, because I feel it's easier for the reader to
see the reply, rather than having to go to the bottom of the previous
message. But, since this is the main newsgroup I post in, I thought I'd ask
its members, especially Sir Larry, what the preferred method is (if any).
Here are the links the fellow provided me:
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |