Ok, I think I see what you're doing - conditional controls based on persisted logic. However the eventable control, the "submit" button (linkButton) still isn't conditional, which is what I'm trying to achieve.
A simplified version of what I want to do is as follows:
********************************
Initial page state:
Label->"State 1"
Button1->"Go to State 2"
(No Button2)
After clicking Button1:
Label->"State 2"
(No Button1)
Button2->"go to State 1"
********************************
This means that initially Button1 is placed on the page, while Button2 isn't. When Button1 is clicked, the page is redrawn without it, but with Button2 instead. Persisted boolean for the toggle logic.
OK, a solution to this simple version is to add both buttons and toggle visibility alternately. But what if a button sits inside another control, e.g. a cell of a row of a table, which is itself conditional? What if I want a dynamically allocated array of buttons, e.g. one per tablerow for dynamic data? Hence its placement is conditional, not just the visibility.
I'm happy to persist the entire set of pre-postback buttons so that the postback world can recreate them, but it's placement on the page that's the problem. The page layout will depend on the logic of the event handler, so no drawing should occur 'til after that.
In other words, I want to be able to catch the event of a button that may or may not be placed after the call. However, it seems ASP wants me to redraw the pre-postback page (or at least the eventable controls) in order for the handler to be called at all.
I thought a possible solution would be to place all the buttons in an invisible PlaceHolder prior to the handler call (e.g. during LoadViewState) so that they're on the page (but invisible), and then place only the visible ones after. Which ones are visible will be decided by the handler call. However, I can't get this to work reliably - events just seem to disappear into the aether. I only get reliable events if all buttons are placed once only per postback.
John