468,248 Members | 1,530 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,248 developers. It's quick & easy.

Button Click events going into Bermuda Triangle, news at 10

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).
Nov 18 '05 #1
2 1237
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, andrepopulate 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 byadding a list box to the page, in Page_Load and Button_Click event addingcode 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 seePage_Load, Button_Click as I would expect (and how it works the very firsttime the page is clicked).
.

Nov 18 '05 #2
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
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Justnew | last post: by
4 posts views Thread by Mick Doherty | last post: by
5 posts views Thread by Smokey Grindel | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.