SelectedIndexChanged not firing in DropDownList

  • Thread starter Thread starter Rocio
  • Start date Start date
R

Rocio

any ideas why?
I have setup my dropdown for AutoPostBack=true, but instead of going
to the SelectedIndexChanged event, it goes to Page_Load. Moreover, one
of the first lines in Page_Load is:

Dim intINdex As Integer = HistoryList.SelectedIndex

but the value it reads for HistoryList.SelectedIndex is 0, not the one
item I selected in my web form.

Any ideas why?

Here is part of my code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim ds As New DataSet
Dim dr As DataRow
Dim intINdex As Integer = HistoryList.SelectedIndex
Dim ctrlUserName As UserNameCtrl
: : : : :



Private Sub HistoryList_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
HistoryList.SelectedIndexChanged
Dim intINdex As Integer = HistoryList.SelectedIndex
If intINdex >= 0 Then
HistoryList.SelectedIndex = intINdex
Else
HistoryList.SelectedIndex = 0
intINdex = 0
End If
btnGo.Attributes.Remove("onclick")
btnGo.Attributes.Add("onclick", _
"window.open('ParcelDetails.aspx?ParcelID=" &
HistoryList.Items(intINdex).Value & "'," & _
"'ParcelDetails', " & _
"'width=600,height=400,menubar=no,toolbar=no,scrollbars=yes,left=0,top=0,resizable=yes');")
End Sub
 
Hi Rocio
i think u r not fully debugging the application
it sure goes to pageload
but after that it fires the selected index
it doesnt matter what code u have writtin on the pageload event
it will always go to pageload event and then the selected index changed
event
in case of more clarification get back to me

Atul
 
Back
Top