I'm looking for some example code, if any exists to handle the scenario below.
I would like to make some cascading (filtering) selected boxes like ebay.com uses when you add a new item.
I'm having difficulties because
- There can be many parent-child relationships. There can exists categories with four or more sub categories.
- I'm not sure if I should add select boxes dynamically though jquery when someone clicks on a parent category, or have many hidden selected boxes on the page and hide/show as needed.
- I'm sure I could look this up, but I'm not sure yet how to use form elements dynamically added though javascript in the code behind.
Does anyone know how eBay does it?
Data would be like this:
Coins US -> Dollars -> Morgan -> 1894-98
or
Stamps -> US -> Covers -> FDC -> 1931-1940
The data will be stored in a sql table with the structure:
Id | CategoryText | ParentId
Each level selected in the tree would result in a new select box to the right of it being generated with the available child values.