G
Guest
VB.NET web program with a webform w/2 dropdownlistboxes, set to AutoPostBack
TRUE, selection in either dropdown fires the SelectedIndexChanged events
correctly UNTIL I navigate to second webform in the same project, THEN use
the Back button to return to first webform; then changing the selection of
the second dropdownlistbox fires the SelectedIndexChanged event for the FIRST
dropdownlistbox.
I realize that a) using an eventhandler for both events, and b) setting
AutoPostBack to FALSE may resolve this issue; HOWEVER, this appears to be a
big fat .NET Framework bug in my VB.NET application. Anyone experience this
bad behavior? The application that demonstrates this is available upon
request, but code is only
Private Sub Page_Load...
If Not (Me.IsPostBack) Then
DropDownList1.Items.Add("DropDownList1 Line 1 Selected")
DropDownList1.Items.Add("DropDownList1 Line 2 Selected - Go To
Webform2")
DropDownList1.Items.Add("DropDownList1 Line 3 Selected")
DropDownList2.Items.Add("DropDownList2 Line 1 Selected")
DropDownList2.Items.Add("DropDownList2 Line 2 Selected")
DropDownList2.Items.Add("DropDownList2 Line 3 Selected")
EndIf
End Sub
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
If DropDownList1.SelectedItem.Text = "DropDownList1 Line 1 Selected"
Then
Label3.Text = DropDownList1.SelectedItem.Text()
End If
If DropDownList1.SelectedItem.Text = "DropDownList1 Line 2 Selected
- Go To Webform2" Then
Label3.Text = DropDownList1.SelectedItem.Text()
Response.Redirect("http://localhost/VB_WebNavigation/Webform2.aspx")
End If
If DropDownList1.SelectedItem.Text = "DropDownList1 Line 3 Selected"
Then
Label3.Text = DropDownList1.SelectedItem.Text()
End If
End Sub
Private Sub DropDownList2_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList2.SelectedIndexChanged
REM event to process the selections
If DropDownList2.SelectedItem.Text = "DropDownList2 Line 1 Selected"
Then
Label3.Text = DropDownList2.SelectedItem.Text()
End If
If DropDownList2.SelectedItem.Text = "DropDownList2 Line 2 Selected"
Then
Label3.Text = DropDownList2.SelectedItem.Text()
End If
If DropDownList2.SelectedItem.Text = "DropDownList2 Line 3 Selected"
Then
Label3.Text = DropDownList2.SelectedItem.Text()
End If
End Sub
Thanks! --
Roger Briggs
ASNA Technical Support Analyst
TRUE, selection in either dropdown fires the SelectedIndexChanged events
correctly UNTIL I navigate to second webform in the same project, THEN use
the Back button to return to first webform; then changing the selection of
the second dropdownlistbox fires the SelectedIndexChanged event for the FIRST
dropdownlistbox.
I realize that a) using an eventhandler for both events, and b) setting
AutoPostBack to FALSE may resolve this issue; HOWEVER, this appears to be a
big fat .NET Framework bug in my VB.NET application. Anyone experience this
bad behavior? The application that demonstrates this is available upon
request, but code is only
Private Sub Page_Load...
If Not (Me.IsPostBack) Then
DropDownList1.Items.Add("DropDownList1 Line 1 Selected")
DropDownList1.Items.Add("DropDownList1 Line 2 Selected - Go To
Webform2")
DropDownList1.Items.Add("DropDownList1 Line 3 Selected")
DropDownList2.Items.Add("DropDownList2 Line 1 Selected")
DropDownList2.Items.Add("DropDownList2 Line 2 Selected")
DropDownList2.Items.Add("DropDownList2 Line 3 Selected")
EndIf
End Sub
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
If DropDownList1.SelectedItem.Text = "DropDownList1 Line 1 Selected"
Then
Label3.Text = DropDownList1.SelectedItem.Text()
End If
If DropDownList1.SelectedItem.Text = "DropDownList1 Line 2 Selected
- Go To Webform2" Then
Label3.Text = DropDownList1.SelectedItem.Text()
Response.Redirect("http://localhost/VB_WebNavigation/Webform2.aspx")
End If
If DropDownList1.SelectedItem.Text = "DropDownList1 Line 3 Selected"
Then
Label3.Text = DropDownList1.SelectedItem.Text()
End If
End Sub
Private Sub DropDownList2_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList2.SelectedIndexChanged
REM event to process the selections
If DropDownList2.SelectedItem.Text = "DropDownList2 Line 1 Selected"
Then
Label3.Text = DropDownList2.SelectedItem.Text()
End If
If DropDownList2.SelectedItem.Text = "DropDownList2 Line 2 Selected"
Then
Label3.Text = DropDownList2.SelectedItem.Text()
End If
If DropDownList2.SelectedItem.Text = "DropDownList2 Line 3 Selected"
Then
Label3.Text = DropDownList2.SelectedItem.Text()
End If
End Sub
Thanks! --
Roger Briggs
ASNA Technical Support Analyst