Connecting Tech Pros Worldwide Forums | Help | Site Map

Catching events from dynamic controls

Newbie
 
Join Date: Jul 2006
Posts: 2
#1: Jul 27 '06
Hi!

This may well have been asked before, but how do you best catch events from dynamic controls in ASP.NET i.e. those created and placed programatically?

An example page layout:
Initially:

Textbox1
Button1
Table1(contains Button2)

After clicking Button1:
Textbox1
Button2 (not inside a table)
Button3

...while clicking Button2 & Button3 should result in yet more dynamic trees & layouts, depending on my shoe size and the position of Jupiter's moons at that time :)

So, I want Button1's handler to change the eventable control tree and page layout. However, it seems I have to recreate and draw the pre-postback tree in order that the Button1 event gets called at all. Then what? How do I replace the already drawn control tree? I don't want to use javascript to force yet another postback as a) it's inefficient and b) a security risk.

BTW I'm recreating the controls early in LoadViewState to avoid any persistence problems.

Have I got the wrong idea? Is there a standard way of achieving this?

TIA,
John



Reply


Similar .NET Framework bytes