Dynamic Controls created by Dynamic Controls

R

Ronald

Hello,

For a registration page I need to constantly create controls
on-the-fly. The input for one control determines the contents of the
next (mostly DropDownLists) control. This is a pretty common practice I
would think.

But, ASP.NET 2.0 will not let me do it. I can dynamically create a
control and read it's PostBack values in the (next) Page_PreLoad event.
But, for a subsequent control to be created based on the value of the
previous control I have to use the next stage, Page_Load. However, for
a control created so late in the PageCycle, ViewState is not restored.

I tried many, many different ways to try and solve this, but none
succeeded. The problem is the PageCycle. It Cycles only once, where I
would need several Cycles for on PageLoad.

Any help/workaround would be greatly appreciated.

Ronald Wijnsema
Netherlands
 
G

Guest

Um, I disagree that it's a common practice. Most developers try to scope out
the business logic of the page, and provide controls whose visibility can be
turned on or off based on certain criteria rather than getting into a "let's
create lots of dynamic controls, because we can!" scenario.

It really sounds to me like you've shot yourself in the foot and need to
re-think the paradigm.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top