Click event wont fire...

Discussion in 'ASP .Net Web Controls' started by Jim Weatherly, Aug 7, 2003.

  1. 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.

    >-----Original Message-----
    >I have a user control (ascx). which creates dynamic

    buttons. The buttons
    >have one click event wired to it. I have to use a

    placeholder to placeit. It
    >works fine, but when i do embed it deep further in a
    >table->row->cell.controls.add(button), the click event

    never fires. Can
    >anybody tell me if this is possible or a workaround is

    possible.
    >
    >Rajesh
    >
    >
    >.
    >
     
    Jim Weatherly, Aug 7, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Purvi T
    Replies:
    0
    Views:
    846
    Purvi T
    Oct 19, 2004
  2. roni
    Replies:
    2
    Views:
    448
  3. Chu
    Replies:
    2
    Views:
    909
    Winista
    Apr 10, 2006
  4. Amy
    Replies:
    0
    Views:
    991
  5. roni

    first click wont fire on dynamic load of usercontro

    roni, Aug 6, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    127
Loading...

Share This Page