Button Click events going into Bermuda Triangle, news at 10

Discussion in 'ASP .Net' started by Michael Johnson Jr., Dec 10, 2003.

  1. here is the problem, I have a table with dynamic buttons and events.
    On buton click of said row, it would clear the rows in the table, and
    repopulate it.

    This works fine the first time you run the app on the first click.

    Every other attempt to click one of these buttons fires a page load only,
    upon the 2nd click a button click event is fired. This was verified by
    adding a list box to the page, in Page_Load and Button_Click event adding
    code to add an item to the listbox denoting which method was called.

    When clicking the buttons, I see Page_Load, clicking a second time I see
    Page_Load, Button_Click as I would expect (and how it works the very first
    time the page is clicked).
    Michael Johnson Jr., Dec 10, 2003
    #1
    1. Advertising

  2. Michael Johnson Jr.

    Suresh Guest

    If your buttons are dynamically created then their events
    (assigning the event handler) and buttons have to be
    recreated on every postback.

    Suresh.


    >-----Original Message-----
    >here is the problem, I have a table with dynamic buttons

    and events.
    >On buton click of said row, it would clear the rows in

    the table, and
    >repopulate it.
    >
    >This works fine the first time you run the app on the

    first click.
    >
    >Every other attempt to click one of these buttons fires a

    page load only,
    >upon the 2nd click a button click event is fired. This

    was verified by
    >adding a list box to the page, in Page_Load and

    Button_Click event adding
    >code to add an item to the listbox denoting which method

    was called.
    >
    >When clicking the buttons, I see Page_Load, clicking a

    second time I see
    >Page_Load, Button_Click as I would expect (and how it

    works the very first
    >time the page is clicked).
    >
    >
    >.
    >
    Suresh, Dec 10, 2003
    #2
    1. Advertising

  3. Michael Johnson Jr.

    Eric Veltman Guest

    Hello Michael,

    Michael Johnson Jr. wrote:

    > here is the problem, I have a table with dynamic buttons and events.
    > On buton click of said row, it would clear the rows in the table, and
    > repopulate it.
    >
    > This works fine the first time you run the app on the first click.
    >
    > Every other attempt to click one of these buttons fires a page load only,
    > upon the 2nd click a button click event is fired. This was verified by
    > adding a list box to the page, in Page_Load and Button_Click event adding
    > code to add an item to the listbox denoting which method was called.
    >
    > When clicking the buttons, I see Page_Load, clicking a second time I see
    > Page_Load, Button_Click as I would expect (and how it works the very first
    > time the page is clicked).


    Besides what Suresh mentioned, you also have to be sure that the identifiers
    of the dynamically created controls are the same when they're first created
    and when they're re-created from Page_Load to restore state.

    In your case I'm almost sure you have to assign the identifiers yourself,
    because with the automatic identifier assignment, I think the identifiers
    won't be the same in the two mentioned cases.

    If you're already assigning identifiers yourself, then it's good to
    check by debugging whether the identifiers are constant.

    Best regards,

    Eric
    Eric Veltman, Dec 11, 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. Purvi T
    Replies:
    0
    Views:
    820
    Purvi T
    Oct 19, 2004
  2. Ben Fidge
    Replies:
    5
    Views:
    717
    S. Justin Gengo
    Jun 15, 2004
  3. henri
    Replies:
    1
    Views:
    372
    Sudsy
    Jun 23, 2004
  4. Amy
    Replies:
    0
    Views:
    954
  5. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    336
    Chris
    Aug 30, 2005
Loading...

Share This Page