By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,187 Members | 1,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,187 IT Pros & Developers. It's quick & easy.

Catching events from dynamic controls

P: 2
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
Jul 27 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.