I am a beginner web developer and I've just begun learning developing with ASP.NET in Visual Studio 2008. So my technical skills are very rudimentary. I spent five hours on this and I have gotten nowhere, really.
Just as my title said, I am attempting to create a vertical navigation list that is dynamic. By dynamic, I mean that it would retrieve its list of data from the database that contains categories and subcategories. The reason why anyone would do this is because it allows the admin to manage products in the database without having to touch the code of the website.
For example, my category table would look like this:
Entertainment, Finance, and Games are the main categories whereas everything else are the subcategories linked to the main categories by its ParentID.
To make a dynamic navigation list for just the categories is easy: just set up a DataList and insert a LinkButton and bind it to the DataSource:
And the result would be this:
Unfortunately, it is clearly the incorrect way to do it as we have the exact list from the category table and it lacks the ideal category->subcategory listing.
The closest solution I've seen was this website: http://www.finalwebsites.com/tutorials/dynamic-navigation-list.php but it is in pure SQL and PHP which I have no understanding of just yet. But its approach is spot on and it works! I just don't know how to do it in ASP.NET.
Please, any advice on this? I am not sure where to go next.
Thanks.
Just as my title said, I am attempting to create a vertical navigation list that is dynamic. By dynamic, I mean that it would retrieve its list of data from the database that contains categories and subcategories. The reason why anyone would do this is because it allows the admin to manage products in the database without having to touch the code of the website.
For example, my category table would look like this:
Code:
categoryID categoryName categoryParentID
1 Entertainment NULL
2 Finance NULL
3 Games NULL
5 Adult 1
6 Family 1
7 Humor 1
8 Business 2
9 Personal 2
10 Stocks 2
11 Arcade 3
12 Classics 3
13 Action 3
Entertainment, Finance, and Games are the main categories whereas everything else are the subcategories linked to the main categories by its ParentID.
To make a dynamic navigation list for just the categories is easy: just set up a DataList and insert a LinkButton and bind it to the DataSource:
And the result would be this:
Unfortunately, it is clearly the incorrect way to do it as we have the exact list from the category table and it lacks the ideal category->subcategory listing.
The closest solution I've seen was this website: http://www.finalwebsites.com/tutorials/dynamic-navigation-list.php but it is in pure SQL and PHP which I have no understanding of just yet. But its approach is spot on and it works! I just don't know how to do it in ASP.NET.
Please, any advice on this? I am not sure where to go next.
Thanks.