Populating a listbox control is very simple. It is the same way as we do in Classic ASP. In classic ASP, we use the tag to add an item to the listbox. In ASP .NET, we use the tag to populate the Listbox.
Listbox Web Server Control - by Das
Sub mySub(sender As Object, e As EventArgs)
If lstStates.SelectedIndex > -1
lblMsg.Text = "You selected: " + lstStates.SelectedItem.Text
Else
lblMsg.Text = "Didn't like any state?"
End If
End Sub
Re: How to populate a Listbox control using ASP.NET?
Populating a listbox control is very simple. It is the same way as we do in Classic ASP. In classic ASP, we use the tag to add an item to the listbox. In ASP .NET, we use the tag to populate the Listbox.
Listbox Web Server Control - by Das
Sub mySub(sender As Object, e As EventArgs)
If lstStates.SelectedIndex > -1
lblMsg.Text = "You selected: " + lstStates.SelectedItem.Text
Else
lblMsg.Text = "Didn't like any state?"
End If
End Sub
ASP.NET Listbox Server Control
Florida
Georgia
Ohio