Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one table in a de-normalized form Named 'Category Classification' in which i have 4 fields like Category, Subcategory, Brand and Company. I want to develop a searching criteria on asp.net in which the scenario would be:

* If i select category from the drop down, It should automatically show the subcategories associated with that selected category in the next drop down of the subcategory.

* Same goes for the brand as well. If i select the subcategory, The grid should appear with the check boxes of the related brands of that selected subcategory.

The screen shot of the said criteria is attached along.

What I have tried:

[removed duplicate information]

I need the logic behind the denormalized database like Microsoft excel has that functionality which i need to implement on asp.net.
Posted
Updated 25-Aug-17 4:15am
v3

1 solution

The sql is pretty straightforward.

The sql to bind the first dropdown would be something like:
SQL
SELECT DISTINCT category
FROM [Category Classification]
ORDER BY category


The sql for the second one would be
SQL
SELECT DISTINCT Subcategory
FROM [Category Classification]
WHERE Category = @Category -- pass in the currently selected category
ORDER BY Subcategory


These are often referred to as cascading dropdowns and there are many ways to do them so you may want to google for some examples if you are stuck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900