dynamic listItems - event NOT fired

P

preetith

Hello,
Though there are numerous posts on this issue , there
are no answers at all to any of them !!
My Situation is , I have a dropdownlist that gets
populated on a button click event, this works fine but
when I select an item on this dropdownlist ,
SelectedIndexChanged event does not get fired.The reason
is that the dynamically created listitems are lost between
the posts ...Can someone provide a solution to my problem ?

thanks,
preeti
 
A

Alvin Bruney

There are answers but people only say that because they are too lazy to
search for it. you must hook your event handler code in page load every
time. otherwise it won't behave right.
 
K

Ken Cox [Microsoft MVP]

Can you show us the complete code that is failing?

Do you have autopostback set to true?
Are you mistakenly resetting the control on each postback?

Ken

--
Microsoft MVPs have a question for *you*: Are you patched against the Worm?
http://www.microsoft.com/security/security_bulletins/ms03-026.asp



Hello,
Though there are numerous posts on this issue , there
are no answers at all to any of them !!
My Situation is , I have a dropdownlist that gets
populated on a button click event, this works fine but
when I select an item on this dropdownlist ,
SelectedIndexChanged event does not get fired.The reason
is that the dynamically created listitems are lost between
the posts ...Can someone provide a solution to my problem ?

thanks,
preeti
 
P

preetith

Thanks Ken and Alvin for replying to my query.
I had done all that you both have mentioned but what I
missed was the uniqueID.My DDL is embedded within a TABLE
heirarchy and all the tables are not given uniqueIDs hence
the control's event did not get fired.Now am creating the
DDL dynamically and adding it to the tablecell and it
automatically receives a uniqueID and remembers it between
posts.
regards,
preeti
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top