Asp.net Getting Started Tutorial: ASP. NET SortedList object tutorial
SortedList object features a combination of ArrayList objects and hash table objects.
Example
For example, 1-S ortedListR adioButtonList
For example, 2-S ortedListR adiobuttonList
For example, 3-S ortedList drop-down list
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>
</Html> added. <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>
</Html> then, when we add a subroutine to be executed, the user clicks a project RadioButtonList control. When a single-choice button is clicked, a text will appear in a tag: <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 subsub displayMessage (s as Object, e As EventArgs)
Lbl1.text = "Your favorite country is:" & rb. SelectedItem. Text
End sub
</Script> <Body> <form runat = "server">
<Asp: RadioButtonList id = "rb" runat = "server"
AutoPostBack = "True" onSelectedIndexChanged = "displayMessage"/>
<P> <asp: label id = "lbl1" runat = "server"/> </p>
</Form> </body>
</Html>