Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Dynamic Controls created by Dynamic Controls

Reply
Thread Tools

Dynamic Controls created by Dynamic Controls

 
 
Ronald
Guest
Posts: n/a
 
      01-16-2006
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      01-16-2006
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"Ronald" wrote:

> 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
>
>

 
Reply With Quote
 
 
 
 
Robbe Morris [C# MVP]
Guest
Posts: n/a
 
      01-17-2006
I'm not 100% certain what your exact requirements are.
However, this article demonstrates how to recreate
"dynamically created" controls based on the Request.Form
collection.

You may find it useful.

http://www.eggheadcafe.com/articles/...xviewstate.asp

--
Robbe Morris - 2004-2006 Microsoft MVP C#
http://www.eggheadcafe.com/forums/merit.asp





"Ronald" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
aspnet.mdf file still is created even though i created a custom provider? Sunfire ASP .Net 1 11-10-2007 04:30 AM
OleDbDataAdapter created in code behaves differently from one created by wizard. tom c ASP .Net 6 09-06-2006 04:46 PM
are the objects created in the stack guarranted to have been created? jimjim C++ 12 06-03-2005 12:57 PM
IP Conflict . . . (or the Heavens created networking, hell created DHCP) dumbrock NZ Computing 4 10-21-2004 04:57 PM
schemalocation entry in XML created by castor created sources? Ulf Heyder XML 0 10-16-2003 02:14 PM



Advertisments