By Greg McCormick
While developing a Classified Ads application I ran into an interesting issue while building the
Submit a New Ad form. I wanted to assign a category and a subcategory to the ad (see an example). I was doing this by using two dropdown lists. The problem with doing this using ASP arises after you select your choice in the first list. Say you chose
Automobiles. In the second list you have subcategories that contain everything but the kitchen sink. What you really want is only the
Automobile related subcategories to show up in the list.
The database that I am using has two tables that look like this:
|Category_id||Autonumber||Key of the table|
|Category||Text||Name of the Category|
|Subcategory_id||Autonumber||Key of the table|
|Subcategory||Text||Name of the Subcategory|
|Subcategory_of||Number||This category that this is a subcategory of.|
The code is quite lengthy. To view the code in text format, click here!
How this works
About the Author
I am a developer in Houston, TX and would be glad to answer any questions that I can about this article.