ASP. NET Web Forms-Hashtable object, formshashtable

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.