473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

managing hierarchical data - categories

Hi,

I want to store product categories in my db and am a little lost as to where
to start.

They can be hierarchical, such as "Books" > "Cook Books", so my table is
like this:

int CategoryId
int ParentCategoryI d Nullable
string Description

with a foreign key from ParentCategoryI d to CategoryId

I want to have the following functionality on my site:

list top level categories (those with no ParentCategoryI d)
list subcategories of a category (1 level deep)
list full "path" of a category ("Books" > "Home Decorating" > "Criminals" >
"Martha Stuart")

put all the categories in a treeview control (don't know which one)
put all the categories in a select menu, like this:

<select>
<optGroup label="Books">
<option value="1">All</option>
<option value="3">Cooki ng</option>
<option value="99">Comp uters</option>
<optgroup label="Phones">
<option value=22>All></option>
<option value=44>Motoro la</option>
</optgroup>
</optgroup>
<optgroup label="Cars">
<option value=5>All</option>
<option value=33>Mazdas </option>
</optgroup>
</select>

What is the best way to do this? I don't need help on how to display the
info once I have it, but I'd like to know how to efficiently retrieve it
from the database and store it in the appropriate data structure (pref C#).
I noticed the WebForms tree control has some of the functionality I want
such as the FullPath property, but there doesn't seem to be a similar one
for web forms. Thanks!

Neil M
Nov 18 '05 #1
1 1859
What do you thinj about this tree...

http://www.eztree-msdn.com

Thanks

lj

"Neil McGuigan" <no************ *****@shaw.ca> a écrit dans le message de
news: gEh2c.693730$JQ 1.615001@pd7tw1 no...
Hi,

I want to store product categories in my db and am a little lost as to where to start.

They can be hierarchical, such as "Books" > "Cook Books", so my table is
like this:

int CategoryId
int ParentCategoryI d Nullable
string Description

with a foreign key from ParentCategoryI d to CategoryId

I want to have the following functionality on my site:

list top level categories (those with no ParentCategoryI d)
list subcategories of a category (1 level deep)
list full "path" of a category ("Books" > "Home Decorating" > "Criminals"

"Martha Stuart")

put all the categories in a treeview control (don't know which one)
put all the categories in a select menu, like this:

<select>
<optGroup label="Books">
<option value="1">All</option>
<option value="3">Cooki ng</option>
<option value="99">Comp uters</option>
<optgroup label="Phones">
<option value=22>All></option>
<option value=44>Motoro la</option>
</optgroup>
</optgroup>
<optgroup label="Cars">
<option value=5>All</option>
<option value=33>Mazdas </option>
</optgroup>
</select>

What is the best way to do this? I don't need help on how to display the
info once I have it, but I'd like to know how to efficiently retrieve it
from the database and store it in the appropriate data structure (pref C#). I noticed the WebForms tree control has some of the functionality I want
such as the FullPath property, but there doesn't seem to be a similar one
for web forms. Thanks!

Neil M

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2598
by: Daisy | last post by:
Let's say I've got a forum, where users can be moderators of each forum. Tables look like this: USER -------- user_key name FORUM
5
2239
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...
0
1430
by: stigbn | last post by:
When a DataSet is used as data source for a DataGrid one can get hiearachical datagrid by using relations among the DataTables of the DataSet. (By hierarchical datagrid, I mean columns that can be expanded and collapsed with '+' buttons). How can I achieve a hierarchical DataGrid when using an ArrayList as data source? I have tried...
0
1762
by: Björn Bengtsson | last post by:
Hello! I have an urgent problem concerning ASP.NET, ADO.NET, SQL Server, XML and the TreeView control. I have two tables; one describing the products and one describing their relationships. A product may consist of multiple other products. So far everything is great. But one product may exist as a subproduct to multiple parent products. ...
3
1451
by: neverstill | last post by:
So I thought I had a solution to my problem using DataRelations with the DataSet. I need to display hierarchical data. I have a DataList nested into another DataList. My datasource is a DataSet with 2 tables and a couple of DataRelations. I thought that I could catch the items as they were bouind in ItemDataBound(), then from there get...
1
1116
by: kamkoum | last post by:
Hello, I am using readxml to retrieve data from an xml file to a dataset. m xml file has hierarchical data (2 levels) so the dataset will contain tables. My question : I need to display this data like this :
4
2042
by: emzyme20 | last post by:
Hi, I am trying to populate a list control that is bound to a data table but the display member needs to come from a different data table. I have two list controls in C#, one displaying available categories and one displaying selected categories. In the database these are represented in two tables, the available category table has an ID...
5
2652
by: Kent Boogaart | last post by:
Hi, I have some hierarchical data (FAQs) that I would like to bind to. The basic structure is: FAQ Category + Categories + FAQs So an FAQ category has any number of sub-categories and any number of FAQs.
0
968
by: premdio | last post by:
Hi all, i have a problem with nested results. i have to show the main categories and the total number of sub categories next to it. This number should include children for the children also. Say for example if i have a main category called music, and it has rock as a sub which may have soft rock and hard rock as its subs, then i have to show...
0
7694
marktang
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...
0
7609
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...
0
8118
jinu1996
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...
1
7666
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...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.