listbox.selecteditem.text
I have a listbox on an asp page. When the user clicks on a selection I want to pass the text back in a querystring. Why is it that no matter what item the user clicks on, it does not affect listbox.selecteditem.text? IE...if the index is 1 when the page is loaded and the user clicks on the 3rd index, the code says that the selected index is 1?
Here is the code I am using:
VB Code:
Private Sub lstSubDirs_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstSubDirs.SelectedIndexChanged
Response.Redirect("WebPage1.aspx?dir=" & lstSubDirs.SelectedItem.Text)
End Sub
I have autopostback=true (else this event won't fire). I am not sure if that matters.