[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.
Re: DropDownList property
Change the AutoPostBack to be true and use the SelectedIndexChanged
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.
Re: DropDownList property
what happens when you step through the code.. is myError set to true?
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.
Re: DropDownList property
Got it working as you said. My fault setting AutoPost = True on wrong DropDownList. Sorry, thank you for your help.
Re: [Resolved] DropDownList property
You may also want to look at the CascadingDropDown controls in ASP.NET AJAX to avoid a postback