DropDownList "SelectedIndexChanged" event

Discussion in 'ASP .Net Web Controls' started by Greg Smith, Nov 12, 2003.

  1. Greg Smith

    Greg Smith Guest

    I am working on my first web app. The SelectedIndexChanged event for the
    DropDownList control doesn't seem to fire when the item is changed.
    Obviously there is something more I need to do. Can anybody fill me in?

    Any help is greatly appreciated.
     
    Greg Smith, Nov 12, 2003
    #1
    1. Advertisements

  2. I had the same problem. You need to set the autopostback on the listbox
    control parameters. You need to send the page back to the server to
    respond to the event.

    You would think this would happen automatically with the event but it
    doesn't. Apparently it is intended to leave that processing control in
    your hands to determine when to cause an autopostback.....

    Hope this helps move you on your way....
     
    helper of codes, Nov 12, 2003
    #2
    1. Advertisements

  3. Greg Smith

    Greg Smith Guest

    Thanks!
     
    Greg Smith, Nov 12, 2003
    #3
  4. Greg Smith

    Pai Guest

    u need to set the AutoPostBack Propoerty of the control to true......
     
    Pai, Nov 12, 2003
    #4
  5. Greg Smith

    MSFT Guest

    MSFT, Nov 13, 2003
    #5
  6. Greg Smith

    Greg Smith Guest

    I had the same problem. You need to set the autopostback on the listbox
    Opps! just ran into another problem. I am loading the DropDownList in the
    Page_load event. When I click on the control it posts back and fires the
    page_load event and I double up on the items listed in the control. If I
    put a "Clear" in there first then it looks fine but I have lost my
    selection. It is back at an index of 0;

    Is there a better way of doing this?
     
    Greg Smith, Nov 13, 2003
    #6
  7. Greg Smith

    MSFT Guest

    Hi Greg,

    You can determine if the the page is postback or not, and then deside if
    add the items again. For example:

    If not IsPostBack then
    ...

    End If

    Luke
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    MSFT, Nov 14, 2003
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.