HTML Item ComboBox

Relevant categories: Microsoft .NET

HTMLItemComboBox is a custom web control that is similar to ASP ComboBox but instead only having to define the items as text; in the HTMLItemComboBox you can use any HTML item as input. That means for example you could define a ComboBox of images, italic words and any other HTML items you wish. Therefore you can have a ComboBox that contains different type of items.

Each item in the ComboBox has a value attribute which is different from what we see in the ComboBox. Therefore for defining every item for the HTMLItemComboBox you should define a pair of value and key, which key is what we see in the combobox and value is a velue behind each item. So it is very important that everytime an item is selected in the HTMLItemComboBox the value is returned. That is why the public property SelectedValue is defined. By selecting each item the page will be post backed and the SelectedValue will be set to the value of the selected item. To do this an eventhandler called SelectedIndexChanged has been defined.

One of the important abilities of HTMLItemComboBox web control is that you could move on the items using the up and down arrow keys or the mouse. If using arrow keys the server control could scroll the list of items and after reaching the specific item you could press ENTER to select the item.


Links: