Click here to Skip to main content
11,932,103 members (59,802 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


5 bookmarked

DropDown List With OptGroup Support

, 18 Aug 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
How to add OptGroup support to your dropdown list control


This tip shows you how to add OptGroup support to your dropdown list control.

Using the Code

  1. Download the file in the attachment & add the two folders App_Browser & App_Code to your project.
  2. After that, use the following code to create & populate your dropdown List control.
    //To bind data to dropDown Use ListItem
    ListItem item1 = new ListItem("A", "1");
    item1.Attributes["OptionGroup"] = "Alphabet";
    ListItem item2 = new ListItem("B", "2");
    item2.Attributes["OptionGroup"] = "Alphabet";
    ListItem item3 = new ListItem("One", "3");
    item3.Attributes["OptionGroup"] = "Numbers";
    ListItem item4 = new ListItem("Two", "4");
    item4.Attributes["OptionGroup"] = "Numbers";


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


About the Author

Poonamchand Soni
Software Developer
India India
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionBetter Explanation/example Pin
Member 1134373423-Nov-15 8:38
memberMember 1134373423-Nov-15 8:38 
BugSelect lost AutoPostBack="true" Pin
Member 1153880319-Mar-15 6:59
memberMember 1153880319-Mar-15 6:59 
GeneralMy vote of 1 Pin
Pratik Bhuva21-Aug-14 22:00
professionalPratik Bhuva21-Aug-14 22:00 
BugDoesn't Work and the details provided not clear Pin
YashmanGupta4-Jun-14 8:12
memberYashmanGupta4-Jun-14 8:12 
QuestionOptionGroup is lost Pin
Txarlie5-Nov-13 5:11
memberTxarlie5-Nov-13 5:11 
GeneralMy vote of 2 Pin
Nitesh Luharuka17-Aug-13 19:52
memberNitesh Luharuka17-Aug-13 19:52 
QuestionRe: My vote of 2 Pin
taranom123423-Dec-13 21:33
membertaranom123423-Dec-13 21:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.151126.1 | Last Updated 19 Aug 2013
Article Copyright 2013 by Poonamchand Soni
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid