Results 1 to 7 of 7

Thread: [Resolved] DropDownList property

  1. #1

    Thread Starter
    Fanatic Member snufse's Avatar
    Join Date
    Jul 2004
    Location
    Jupiter, FL
    Posts
    912

    [Resolved] DropDownList property

    Is there a porperty for the DropDownList that will allow code to be executed as soon as I select from the list without having to use a command button. I've tried using the SelectedIndexchanging and SelectedIndexChanged. Once user selects from list I need to programatically fill another DropDownList. Thank you.
    Last edited by snufse; Sep 19th, 2008 at 07:18 AM.

  2. #2
    Hyperactive Member
    Join Date
    May 2005
    Posts
    262

    Re: DropDownList property

    Change the AutoPostBack to be true and use the SelectedIndexChanged

  3. #3

    Thread Starter
    Fanatic Member snufse's Avatar
    Join Date
    Jul 2004
    Location
    Jupiter, FL
    Posts
    912

    Re: DropDownList property

    I have set the DropDownList property AutoPostBack = True and added

    Code:
    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
    
            ValidateInput()
            If myError = False Then
                BuildConnectString()
                OpenConnection()
                FillDropDownList()
                CloseConnection()
            End If
    
        End Sub

    Program does not hit the sub unless I use and click a button.

  4. #4
    Hyperactive Member
    Join Date
    May 2005
    Posts
    262

    Re: DropDownList property

    what happens when you step through the code.. is myError set to true?

  5. #5

    Thread Starter
    Fanatic Member snufse's Avatar
    Join Date
    Jul 2004
    Location
    Jupiter, FL
    Posts
    912

    Re: DropDownList property

    When I select from DropDownList nothing happens. If I add a Button and click the button after selecting from DropDownList, then it hits the sub.

  6. #6

    Thread Starter
    Fanatic Member snufse's Avatar
    Join Date
    Jul 2004
    Location
    Jupiter, FL
    Posts
    912

    Re: DropDownList property

    Got it working as you said. My fault setting AutoPost = True on wrong DropDownList. Sorry, thank you for your help.

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [Resolved] DropDownList property

    You may also want to look at the CascadingDropDown controls in ASP.NET AJAX to avoid a postback

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