ASP.Net/Collections/DictionaryEntry — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 11:51, 26 мая 2010
DictionaryEntry working with an ArrayList
<%@Page language="vb" debug="true" %>
<script runat="server" language="vb">
Sub Page_Load(Source As Object, E as EventArgs)
Dim mySortedList as new SortedList
Dim Item As DictionaryEntry
mySortedList("A")="AA"
mySortedList("B")="BB"
mySortedList("C")="CC"
mySortedList("D")="DD"
If Not Page.IsPostback
For Each Item In mySortedList
Dim newListItem As new ListItem()
newListItem.Text = Item.Key
newListItem.Value = Item.Value
myDropDownList.Items.Add(newListItem)
Next
End If
End Sub
Sub Click(Source As Object, E as EventArgs)
myLabel.Text = myDropDownList.SelectedItem.Value
End Sub
</script>
<html>
<form runat="server">
Pick a word from the list:
<asp:dropdownlist id="myDropDownList" runat="server" />
<asp:button id="myButton" runat="server" text="OK" Onclick="Click" />
<br /><br />
<b>Definition: </b>
<asp:Label id="myLabel" runat="server" text="" />
</form>
</html>