Click here to Skip to main content
12,951,034 members (53,223 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


5 bookmarked
Posted 17 Aug 2013

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 7:38
memberMember 1134373423-Nov-15 7:38 
BugSelect lost AutoPostBack="true" Pin
Member 1153880319-Mar-15 5:59
memberMember 1153880319-Mar-15 5:59 
GeneralMy vote of 1 Pin
Pratik Bhuva21-Aug-14 21:00
professionalPratik Bhuva21-Aug-14 21:00 
BugDoesn't Work and the details provided not clear Pin
YashmanGupta4-Jun-14 7:12
memberYashmanGupta4-Jun-14 7:12 
QuestionOptionGroup is lost Pin
Txarlie5-Nov-13 4:11
memberTxarlie5-Nov-13 4:11 
GeneralMy vote of 2 Pin
Nitesh Luharuka17-Aug-13 18:52
memberNitesh Luharuka17-Aug-13 18:52 
QuestionRe: My vote of 2 Pin
taranom123423-Dec-13 20:33
membertaranom123423-Dec-13 20: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.

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