rebinding event handlers, how?

Discussion in 'ASP .Net' started by lauralucas, Jul 13, 2006.

  1. lauralucas

    lauralucas Guest

    Hi
    I'm creating controls programatically. On postback, the events of the
    controls are not triggered correctly. I need to not only rebind the
    controls to their datasource on every load, but reassign the event
    handlers.

    but how?

    I should do this in the Page's Init event handler rather than in the
    Page_Load
    event handler right?

    help me please, I'm stuck
     
    lauralucas, Jul 13, 2006
    #1
    1. Advertisements

  2. lauralucas

    Guest Guest

    Init would be a far better choice than Load since a lot can happen between
    Init and Load. If you assign your event handlers in the init event it should
    fire properly. If that is not working could you provide us with more detail?
     
    Guest, Jul 13, 2006
    #2
    1. Advertisements

  3. lauralucas

    lauralucas Guest

    I don't know how to assign event handlers programatically to an object
    yet, how do yo do it?
    more especifically, a buttoncolumn in a datagrid.
     
    lauralucas, Jul 13, 2006
    #3
  4. lauralucas

    Guest Guest

    myButton.Click += new EventHandler(myButton_Click);

    Where myButton_Click is the method that will handle the event.
     
    Guest, Jul 13, 2006
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.