I am attempting to enable a drop down list when an item is selected in another drop down list.
Here is my code:
Protected Sub ddlDepartment_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ddlDepartment.SelectedIndexChanged
ddlDivision.Enabled = True
End Sub
But it does not enable the other drop down list. What do I need to do?
When you select a value in the first drop down, is the page performing a postback or just sitting there? If it isn’t performing a postback, that is why, you haven’t registered the event you defined with the control yet, and that needs to happen.
The page does not flicker and I don’t have the control in an update panel, so I have to say that it does not do a postback. What do I need to do to force it too?
Within the aspx file there are two properties you can set. AutoPostBack (needs to be true), and OnSelectedIndexChanged (needs to have ddlDepartment_SelectedIndexChanged)
When I click on the drop down, it works, but when I select the first drop down list box, it always go back to the first item in the list no matter what I select.
I uploaded a video on YouTube. There is no sound but you can see that when I click on the item in the drop down no matter what it is, the first item is displayed.
Here is the link: http://youtu.be/gIbbCdZJZVM
cpradio, your original solution worked. The reason that the same value displayed was because I selected the wrong field in my database. That field only had three unique records. So it would select the first from a series of records. After referencing the right field, everything works as well as the postback. Thanks for the help.