Hi Adrian,
Welcome to ASP.NET newsgroup.
As for the creating new control after a certain postback event and make it
exist in all the sequesntial post(the control can't be precreated and set
to invisible), I think this is a common problem when developing a cutsom
web server control. Since Each dynamically created control should be
created and added into sub control's colletion in Page's Init or Load event
(before page processing postback events) so that those dynamic controls
can hanle their own postback events correctly( if they have postback
events). However, if we only create them in postback event or later,
they'll surely to disappear in the later request and event won't work
correctly.
Currently, as I've done in some former posts, the formal way is to provide
a certain flag value( can be a page's class member variable or control's
member is you are developing a custom control). That flag value should be
persisted into ViewState so as to remain between postback. Then, in our
page/custom control's Init or Load event, we create those dynamic controls
depending on the flag values. And we can set this flag value in postback
event(also modify the dyanmic controls). Then, in the sequential
post/request, those dynamic controls will always be created since the flag
value is set in the viewstate.
Here is a former thread discussing on the similiar problem:
http://groups.google.com/groups?thre...msftngxa10.phx.
gbl&rnum=1&prev=/groups%3Fq%3Dasp.net%2Bdynamic%2Bcontrol%2Bpostbac k%2Bsteve
n%2Bcheng%26hl%3Dzh-CN
Hope helps. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)