Net Tutorial: ASP. NET SortedList object

Source: Internet
Author: User

Net Tutorial: ASP. NET SortedList object

SortedList object features a combination of ArrayList objects and hash table objects.

In the SortedList object
The SortedList object contains the key/value pairs of the project. A SortedList Automatically sorts the project letters or numbers in an object.

The project is added to SortedList and the purchase () method. The size of a SortedList can be used as the final size and TrimToSize () method.

The following code creates a SortedList named mycountries and four elements:

<Script runat = "server">
Sub Page_Load
If Not Page. IsPostBack then
Dim mycountries = New SortedList
Mycountries. Add ("N", "Norway ")
Mycountries. Add ("S", "Sweden ")
Mycountries. Add ("F", "France ")
Mycountries. Add ("I", "Italy ")
End if
End sub
</Script>
Controls the text and values automatically generated by the data-bound adsortedlist object: dynamic: RadioButtonList dynamic: CheckBoxList dynamic: pull-down list dynamic: The list box binds data to the RadioButtonList control, first, create a RadioButtonList control (without any ASP: ListItem element. Aspx page: html>
<Body> <form runat = "server">
<Asp: RadioButtonList id = "rb" runat = "server"
AutoPostBack = "True"/> </form> </body>
<Ml> then add a script to create a list: <script runat = "server">
Sub Page_Load
If Not Page. IsPostBack then
Dim mycountries = New SortedList
Mycountries. Add ("N", "Norway ")
Mycountries. Add ("S", "Sweden ")
Mycountries. Add ("F", "France ")
Mycountries. Add ("I", "Italy ")
Rb. DataSource = mycountries rb. DataValueField = "Key" rb. DataTextField = "Value" rb. DataBind ()
End if
End sub
</Script> <Body> <form runat = "server">
<Asp: RadioButtonList id = "rb" runat = "server"
AutoPostBack = "True"/> </form> </body>
<Ml>

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.