简体   繁体   中英

doesn't fire selected index changed event for a drop down list created on run time

Q:

I have the following case :

a button , when clicking on this button , create a drop down list on run time ,and make an event(selected index changed ) for the drop down list..

but what happen is half the previous scenario , i mean creating the drop down list on run time but it doesn't enter the(selected index changed)..

i don't know what is the problem?

Not sure what the exact scenario is, but every time you postback, you'll have to create the drop down list and register to the event. Couldn't you hide/show and populate the dropdown box on click of the button? Have a look at the link for a similar issue.

http://www.dreamincode.net/forums/topic/165499-access-selectedindex-of-dropdownlist-created-at-runtime/

Haven't tried this myself, but this link might help you, if you must add the control dynamically http://shawpnendu.blogspot.com/2010/04/runtime-add-dynamic-dropdownlist-and.html

did you set ddl.AutoPostBack = true; when adding control runtime?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM