Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
2.00/5 (5 votes)
See more:
hi!
i want to populate a multi level dropdown list i.e
Drinks
__SoftDrinks
____SoftDrinks1
____SoftDrinks2
__OtherDrinks
Foods
__Fast Food
____Burger
____Pizza


Could anybody help me out.
Thanks
Posted
Comments
Rob Branaghan 26-Apr-11 6:37am    
Perhaps you may have to create a user control for this?
Ankit Rajput 26-Apr-11 7:03am    
I think there is no functionality in .Net Framework
You have to create your own control.
Ankur\m/ 27-Apr-11 0:21am    
The question seems fine to me and doesn't deserve 1 vote. My 5 to counter the vote!

I think you can work around this using different indentation based on the category.
You can do this either at the database level or in the front end. Just add proper white-spaces before each item based on the category. Whenever you need the Text/SelectedText of the dropdownlist, get the value, use Trim function and then use it.

Hope this helps!
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 26-Apr-11 16:37pm    
Why? This is tree...
--SA
Ankur\m/ 27-Apr-11 0:17am    
This looks like tree and can be easily implemented using a TreeView Control. But as per my understanding of the question, the OP wants a similar functionality in a Dropdownlist.
Sergey Alexandrovich Kryukov 27-Apr-11 0:28am    
That's my point -- not always to do what OP "wants". There is a big difference between "wants" and "thinks she/he wants". In some cases it is obvious.
--SA
Ankur\m/ 27-Apr-11 0:36am    
You mean my interpretation of the question is wrong or the OP's understanding of the scenario is wrong?
Ankur\m/ 27-Apr-11 0:57am    
I asked this because I feel it's perfectly alright to think of such kind of UI. Indented values in a DDL gives a better understanding of the values to a user.
http://www.codeproject.com/KB/tree/dropdowntree.aspx - this link given by Sandeep talks about the same thing.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 26-Apr-11 16:37pm    
Multi-level list means "tree" and nothing else!
A 5.
--SA
Sandeep Mewara 27-Apr-11 0:20am    
Thanks SA.
Monjurul Habib 27-Apr-11 15:33pm    
nice links.my 5.
Sandeep Mewara 28-Apr-11 0:27am    
Thanks.
 
Share this answer
 
Comments
Sandeep Mewara 28-Apr-11 0:28am    
My 5 if OP looking for ASP.NET thing
Monjurul Habib 28-Apr-11 12:00pm    
thank you.

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