Results 1 to 3 of 3

Thread: drop down list event

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    KC
    Posts
    8

    Question 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

  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    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
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    KC
    Posts
    8

    Thumbs up Thanks!!

    That works really well!! Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width