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

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:
    1,125
    Purvi T
    Oct 19, 2004
  2. =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=

    Fire Code behind code AND Javascript code associated to a Button Click Event

    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    21,761
    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=
    Feb 11, 2004
  3. shland
    Replies:
    1
    Views:
    693
    shland
    Mar 1, 2004
  4. roni
    Replies:
    2
    Views:
    542
  5. Chu
    Replies:
    2
    Views:
    1,064
    Winista
    Apr 10, 2006
  6. Amy
    Replies:
    0
    Views:
    1,247
  7. Max2006
    Replies:
    2
    Views:
    1,806
    Walter Wang [MSFT]
    Sep 19, 2007
  8. roni

    first click wont fire on dynamic load of usercontro

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