Click here to Skip to main content
Click here to Skip to main content

DropDown List With OptGroup Support

, 18 Aug 2013
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

Comments and Discussions

BugDoesn't Work and the details provided not clear PinmemberYashmanGupta4-Jun-14 7:12 
QuestionOptionGroup is lost PinmemberTxarlie5-Nov-13 4:11 
GeneralMy vote of 2 PinmemberNitesh Luharuka17-Aug-13 18:52 
QuestionRe: My vote of 2 Pinmembertaranom123423-Dec-13 20:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web03 | 2.8.140721.1 | Last Updated 19 Aug 2013
Article Copyright 2013 by Poonamchand Soni
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid