Click to See Complete Forum and Search --> : Creating a forum - PROBLEMS!


Dreamon
April 25th, 2003, 04:21 PM
I'm in the process of developing a discussion forum for my website. I will use a DataGrid to display it.
Now, the first page I want to display will be the forum categories one can choose from. My database table for this looks like this:

ForumCategoryID (int autoincrement), Category (nvarchar), Description (nvarchar), Active (bit), ParentID (int).
ParentID is to determine if the Category is a header or a child of a header. Example:
ID = 1 ----- Programming (ParentID = 0)
ID = 2 -------- C# (ParentID = 1)
ID = 3 -------- VB.NET (ParentID = 1)
ID = 4 ----- Design (ParentID = 0)
ID = 5 -------- Photoshop (ParentID = 4)
... and so on. You get my drift.

Now, since I'm going to use a DataGrid to display this, I need to create a datasource that will have all the rows from my table in the right order (record with ParentID=0, then it's children, another record with ParentID=0, then it's children.... etc.).

How can I do this? I tried using the DataTable object, but didn't get anywhere with that.

Does anyone have a solution/example/hint/whatever?? Please!

Thanks!