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
But it does not enable the other drop down list. What do I need to do?
That's not html or css code
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'm not following, can you provide a few screenshots?
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
hmmm... That's weird. Also, it still doesn't seem to be performing a post back (at least in the video it didn't post back...)
See the attached example (very simplified), I provided it in both C# and VB.
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.
Glad to hear it.
This topic is now closed. New replies are no longer allowed.