cruncher06 — 2013-06-13T12:15:46-04:00 — #1
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?
picnictutorials — 2013-06-13T12:25:54-04:00 — #2
That's not html or css code
cruncher06 — 2013-06-13T12:28:52-04:00 — #3
cpradio — 2013-06-13T12:33:14-04:00 — #4
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.
cruncher06 — 2013-06-13T12:44:10-04:00 — #5
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?
cpradio — 2013-06-13T13:00:23-04:00 — #6
Within the aspx file there are two properties you can set. AutoPostBack (needs to be true), and OnSelectedIndexChanged (needs to have ddlDepartment_SelectedIndexChanged)
cruncher06 — 2013-06-13T14:11:16-04:00 — #7
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.
cpradio — 2013-06-13T14:27:31-04:00 — #8
I'm not following, can you provide a few screenshots?
cruncher06 — 2013-06-13T16:17:21-04:00 — #9
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 — 2013-06-13T18:02:07-04:00 — #10
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...)
cpradio — 2013-06-14T08:03:28-04:00 — #11
See the attached example (very simplified), I provided it in both C# and VB.
cruncher06 — 2013-06-14T12:29:33-04:00 — #12
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.
cpradio — 2013-06-14T12:49:54-04:00 — #13
Glad to hear it.
system — 2014-10-08T00:24:00-04:00 — #14
This topic is now closed. New replies are no longer allowed.