E
Elroyskimms
I have 3 User Controls...
1) Grandpa Control: Has web controls and a Panel control that has a
Daddy Control in it.
2) Daddy Control: Has a textbox, a couple of buttons and an empty Panel
control.
3) Grandson Control: Has a couple of labels and one button (Delete).
On Page_Load, Granpda Control loads properly and all events are handled
fine. Daddy Control is also loaded and all events are handled fine. In
the empty Panel on the Daddy Control, several instances of the Grandson
Control are added through code (LoadControl). Everything appears to be
fine.
I click the Delete button on Grandson Control #1, the event is handled
and Grandson #1 is deleted. At the end of the Delete Grandson
procedure, I bubble an event up to the Daddy Control signalling it to
empty the Panel of all controls, and re-add the Grandson Controls.
Everything looks fine, all of the Grandson Controls show up except the
recently deleted Grandson Control.
Here is the problem. If I click the Delete button on Grandson Control
#2, the page posts back and all Page_Load procedures are executed...
but the event which handles the Delete button click is not handled.
After the PostBack completes, Grandson #2 is still in the Panel on the
Daddy Control and still in the database.
If I click the delete button again for Grandson #2, the Delete button
click event is fired as expected.
So, 3rd generation control events are handled on every other click.
Why? I've run into this problem before in a much more complicated
scenario. I never got it to work and so I redesigned everything to have
only 2 generations of user controls and every thing worked fine. Please
help!
Thanks!
-E
1) Grandpa Control: Has web controls and a Panel control that has a
Daddy Control in it.
2) Daddy Control: Has a textbox, a couple of buttons and an empty Panel
control.
3) Grandson Control: Has a couple of labels and one button (Delete).
On Page_Load, Granpda Control loads properly and all events are handled
fine. Daddy Control is also loaded and all events are handled fine. In
the empty Panel on the Daddy Control, several instances of the Grandson
Control are added through code (LoadControl). Everything appears to be
fine.
I click the Delete button on Grandson Control #1, the event is handled
and Grandson #1 is deleted. At the end of the Delete Grandson
procedure, I bubble an event up to the Daddy Control signalling it to
empty the Panel of all controls, and re-add the Grandson Controls.
Everything looks fine, all of the Grandson Controls show up except the
recently deleted Grandson Control.
Here is the problem. If I click the Delete button on Grandson Control
#2, the page posts back and all Page_Load procedures are executed...
but the event which handles the Delete button click is not handled.
After the PostBack completes, Grandson #2 is still in the Panel on the
Daddy Control and still in the database.
If I click the delete button again for Grandson #2, the Delete button
click event is fired as expected.
So, 3rd generation control events are handled on every other click.
Why? I've run into this problem before in a much more complicated
scenario. I never got it to work and so I redesigned everything to have
only 2 generations of user controls and every thing worked fine. Please
help!
Thanks!
-E