Click event wont fire...

J

Jim Weatherly

When adding controls dynamically, make sure the entire
object hierarchy gets rebuilt on postbacks. If the
objects don't get rebuilt because it is a postback,
ASP.Net can't find the event handler for the postback
event. Not sure if this is your issue but it has tripped
me up. In fact, I try to avoid dynamically creating
controls on pages. I would rather drop them on the page in
the designer and set the Visible property to false, and
make them visible from code when appropriate. That way
the controls are always present in the object hierarchy
for the page and event mapping is much easier. However,
the controls always get build when the page gets built, so
it is not without a cost.
 

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,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top