ExtendedDropDownList & ExtendedListBox
The SharpPieces ExtendedDropDownList extends the ASP NET DropDownList control, adding the following features:
- Support for OPTGROUP tag, with easy to use syntax
- ListItem's attributes are persisted between postbacks
- CssClass and GroupCssClass for the list items
The SharpPieces ExtendedDropDownList solves an existing problem in the standard DropDownList control, allowing the programmer to define grups using the optgroup tag, either from the .aspx/.ascx or from code behind. The optgroup tag is rendered when you assign some values to the GroupText and GroupType property.
Not only that, you also get persisted attributes, which don't come in the ASP NET DropDownList control. After a postback is made, you won't need to set the attributes again, because they are already loaded from the viewstate.
Along with this, you also get some nice, strong typed properties like CssClass and GroupCssClass. If you decide to add some customization to it, you can easily change the source code provided with the download to fit your needs.
The download package also includes a ExtendedListBox control, with the same functionality as the ExtendedDropDownList control, the main difference is that the ExtendedListBox extends the ASP NET ListBox control, and not the DropDownList control, like the ExtendedDropDownList.