NET Tutorial: ASP.net sortedlist objects
The 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 item. A sortedlist automatically sorts the alphabetical or numeric order of items in an object.
Item added to SortedList and purchase () method. A sortedlist size can be used for its final size and trimtosize () method.
The following code creates a sortedlist named Mycountries and four elements said:
<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>
Data binding a SortedList object can automatically generate text and values the following controls: Dynamic: RadioButtonList Dynamic: CheckBoxList Dynamic: Drop-down list dynamic: List box binding data to RadioButtonList control, First, create a RadioButtonList control (without any asp:listitem elements). ASPX page:html>
<body><form runat= "Server" >
<asp:radiobuttonlist id= "RB" runat= "Server"
autopostback= "True"/></form></body>
< ml> then add the script to build the 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>