Re: crazy event handlers!

Discussion in 'ASP .Net' started by Trevor Hartman, Jun 25, 2003.

  1. it is in the buildTable(), which is executed in the Page_PreRender() event

    -Trevor
    "MikeB" <> wrote in message
    news:...
    >
    > "Trevor Hartman" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > ok I'm adding an event handler programmatically:
    > > editButton.Click += new System.EventHandler(Edit);
    > >
    > > there is an edit function. there are no errors. When i click on the

    edit
    > > button it just posts back but the Edit function doesn't execute! any
    > > ideas?? thanks!

    >
    > In what method do you have the above line of code?
    >
    > --
    > MikeB
    >
    >
    Trevor Hartman, Jun 25, 2003
    #1
    1. Advertising

  2. Trevor Hartman

    MikeB Guest

    "Trevor Hartman" <> wrote in message
    news:...
    > it is in the buildTable(), which is executed in the Page_PreRender() event
    >


    PreRender happens after postback events fire. You should probably add your
    Edit event handler in the PageLoad event.


    > -Trevor
    > "MikeB" <> wrote in message
    > news:...
    > >
    > > "Trevor Hartman" <> wrote in message
    > > news:...
    > > > Hi,
    > > >
    > > > ok I'm adding an event handler programmatically:
    > > > editButton.Click += new System.EventHandler(Edit);
    > > >
    > > > there is an edit function. there are no errors. When i click on the

    > edit
    > > > button it just posts back but the Edit function doesn't execute! any
    > > > ideas?? thanks!

    > >
    > > In what method do you have the above line of code?
    > >
    > > --
    > > MikeB
    > >
    > >

    >
    >


    --
    MikeB
    MikeB, Jun 26, 2003
    #2
    1. Advertising

  3. Trevor Hartman

    PJ Guest

    The Page_Load event happens after the viewstate has been reassigned to the
    controls, therefore you need to assign your event handler in the Page_Init
    event.

    "Trevor Hartman" <> wrote in message
    news:...
    > it is in the buildTable(), which is executed in the Page_PreRender() event
    >
    > -Trevor
    > "MikeB" <> wrote in message
    > news:...
    > >
    > > "Trevor Hartman" <> wrote in message
    > > news:...
    > > > Hi,
    > > >
    > > > ok I'm adding an event handler programmatically:
    > > > editButton.Click += new System.EventHandler(Edit);
    > > >
    > > > there is an edit function. there are no errors. When i click on the

    > edit
    > > > button it just posts back but the Edit function doesn't execute! any
    > > > ideas?? thanks!

    > >
    > > In what method do you have the above line of code?
    > >
    > > --
    > > MikeB
    > >
    > >

    >
    >
    PJ, Jun 26, 2003
    #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. Boban Dragojlovic

    Dynamic Buttons and Event Handlers, revisited

    Boban Dragojlovic, Jun 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,858
    Boban Dragojlovic
    Jun 24, 2003
  2. Oisin Grehan
    Replies:
    3
    Views:
    477
    Natty Gur
    Jul 15, 2003
  3. Robert Millman

    Debug step into event handlers

    Robert Millman, Jul 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    407
    Robert Millman
    Jul 29, 2003
  4. Matt Sogla

    Losing event handlers

    Matt Sogla, Jul 30, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    374
    Alvin Bruney
    Jul 31, 2003
  5. Steve Lewin-Berlin

    Event handlers keep getting unregistered

    Steve Lewin-Berlin, Aug 6, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    315
    Steve Lewin-Berlin
    Aug 6, 2003
Loading...

Share This Page