Event of dynamic control

Discussion in 'ASP .Net' started by Frank Schumacher, Nov 25, 2004.

  1. Hi NG,

    I add some ImageButtons to an user control, using the placeholder object
    as a container. I like to get the clickevent from that button so i added
    a method to the click property:
    myIB.Click += new
    System.Web.UI.ImageClickEventHandler(this.ImageButtonHier_Click);

    where ImageButtonHier_Click is my event handling method.

    The code compiles, but when I click the button, no event is fired.

    Can anyone help me out?

    Thanks in advance,
    Frank
     
    Frank Schumacher, Nov 25, 2004
    #1
    1. Advertising

  2. Frank Schumacher

    Karl Seguin Guest

    The event needs to be hooked up on postback...which means the control must
    be created and added to your placeholder.

    http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx
    Might be of use to you.

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Frank Schumacher" <-leipzig.de> wrote in message
    news:...
    > Hi NG,
    >
    > I add some ImageButtons to an user control, using the placeholder object
    > as a container. I like to get the clickevent from that button so i added
    > a method to the click property:
    > myIB.Click += new
    > System.Web.UI.ImageClickEventHandler(this.ImageButtonHier_Click);
    >
    > where ImageButtonHier_Click is my event handling method.
    >
    > The code compiles, but when I click the button, no event is fired.
    >
    > Can anyone help me out?
    >
    > Thanks in advance,
    > Frank
     
    Karl Seguin, Nov 25, 2004
    #2
    1. Advertising

  3. Thanks for the reply Karl, after making sure that the page is created
    again after postback (even if i don't need the uc anymore) my event has
    fired.

    Karl Seguin wrote:
    > The event needs to be hooked up on postback...which means the control must
    > be created and added to your placeholder.
    >
    > http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx
    > Might be of use to you.
    >
    > Karl
    >
     
    Frank Schumacher, Dec 1, 2004
    #3
    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. Chris Thunell
    Replies:
    3
    Views:
    3,430
    Edward
    Jul 21, 2004
  2. Replies:
    5
    Views:
    5,588
  3. arthernan
    Replies:
    0
    Views:
    1,486
    arthernan
    Mar 10, 2006
  4. Larry Bud
    Replies:
    1
    Views:
    351
    bruce barker
    Jan 10, 2007
  5. Tillman

    Make parent control event call child control event

    Tillman, May 21, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    306
    Tillman
    May 21, 2004
Loading...

Share This Page