ASP. NET Web Forms-Hashtable object, formshashtable
ASP. NET Web Forms-Hashtable object. The Hashtable object contains the items represented by key/value pairs.
Create Hashtable
The Hashtable object contains the items represented by key/value pairs. The key is used as an index. You can use the search key to quickly search for the value.
Use the Add () method to Add a project to Hashtable.
The following code creates a Hashtable object named mycountries and adds four elements:
Data Binding
The Hashtable object can automatically generate text and values for the following controls:
AutoPostBack = "True" onSelectedIndexChanged = "displayMessage"/>
Asp: RadioButtonList
Asp: CheckBoxList
Asp: DropDownList
Asp: Listbox
To bind data to the RadioButtonList control, you must first create a RadioButtonList control (without any asp: ListItem element) on the. aspx page ):
Then add the script for creating the list and bind the values in the list to the RadioButtonList control:
Then we add a child routine. When you click a project in the RadioButtonList control, the child routine will be executed. When a single-choice button is clicked, a line of text appears in the label:
Instance
Note: you cannot select the sorting method for projects added to Hashtable. To sort projects by letters or numbers, use the SortedList object.