-
drop down list event
I'm eveloping a web application (survey) that has a drop down list and a command button. Right now, the user has to make a selection from the list and then hit the command button to fire off the next event. I would like to get rid of the command button altogether. Is there a method for the drop down list that can take the place of the command button_click sub??
It does not seem to work for me to put my VB code in the _SelectedIndexChanged method of the drop down list.
Thanks
Geno
-
In the dropdown list add the following attribute:
Code:
autopostback="true"
Then in your Codebehind, any code not to run on events, put in the following:
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (Not Page.IsPostBack) Then
'This block will not run on events
End If 'IsPostBack
End Sub
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
'This block will run on _SelectedIndexChanged Event
End Sub
-
Thanks!!
That works really well!! Thanks!