473,406 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 ParentCategoryId Nullable
string Description

with a foreign key from ParentCategoryId to CategoryId

I want to have the following functionality on my site:

list top level categories (those with no ParentCategoryId)
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">Cooking</option>
<option value="99">Computers</option>
<optgroup label="Phones">
<option value=22>All></option>
<option value=44>Motorola</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 1847
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$JQ1.615001@pd7tw1no...
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 ParentCategoryId Nullable
string Description

with a foreign key from ParentCategoryId to CategoryId

I want to have the following functionality on my site:

list top level categories (those with no ParentCategoryId)
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">Cooking</option>
<option value="99">Computers</option>
<optgroup label="Phones">
<option value=22>All></option>
<option value=44>Motorola</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
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
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...
0
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...
0
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...
3
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...
1
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...
4
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...
5
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
agi2029
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,...
0
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...

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.