Oops. You wanted a Listbox:
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
If Not IsPostBack Then
Dim strSelectedColor As String
Dim li As New ListItem
Dim enumColor As New KnownColor
Dim Colors As Array = _
[Enum].GetValues(enumColor.GetType())
ListBox1.DataSource = Colors
ListBox1.DataBind()
strSelectedColor = ListBox1.Items(0).Text
li.Value = 0
li.Text = "--ALL"
ListBox1.Items.Insert(0, li)
End If
End Sub
Private Sub DropDownList1_SelectedIndexChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles ListBox1.SelectedIndexChanged
Label1.Text = ListBox1.SelectedItem.Text
End Sub
susie said:
I have an web page with four listboxes created in asp.net. Each listbox
has more than 100 items. Each time I select one item added to another
list, the listbox that I choose items from refreshed to the top. I have to
scroll down the list again each time I chose an item.
How to leave the listbox stay where I left from last selection?
Thank you.