Click here to Skip to main content
15,672,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a drop down list and i want to divide items into two groups, at first group i want to display group name as a title i.e.,india, under this group states should display, but india is not a item means i should not be selected only states should selected, second group also same as first here title is states under this districts should display.
i can add item using drop down list control in but how to set name to group.
can anybody help me plz..
vjdeeds 31-Jan-12 2:34am    
Can you make d question a bit more clear or can you add a sample of your code that can show us what actually you are trying to do.
Zeeshan-Ali89 31-Jan-12 2:43am    
do u want to make parent and its child am i right?

Try This:
<select id="ListBox1" >
       <optgroup label="India"></optgroup>
       <optgroup label="Country">  </optgroup>
Share this answer
Member 13214563 22-May-17 7:08am    
how to check the group of selected item of dropdownlist
TinTinTiTin 22-May-17 9:14am    
$('#ListBox1').on('change', function ()
var label = $(this.options[this.selectedIndex]).closest('optgroup').prop('label');
Member 13214563 22-May-17 9:25am    
how to check if two items are selected from one group only
Use Option Group
Here is code : ASP.NET DropDownList with OptionGroup support[^][^]
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