Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Controls collection
Message
From
17/03/2009 09:05:19
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
Miscellaneous
Thread ID:
01388377
Message ID:
01388643
Views:
26
>>>>Hi,
>>>>I have a WebControl - where I programmatically add new controls.
>>>>During Controls.add() - I check Controls.count - it grows... for example it has now 35 controls
>>>>
>>>>I have a button on this page cmdSave - in Click event I check Me.Controls.count - it has just 9 controls.. most of them - controls which I exact drop on control during design time.
>>>>
>
>I see you've resolved it. Yes, adding controls dynamically in ASP.NET is complicated and it's really easy to not get it right which ends up causing all sorts of viewstate issues. The basic idea is that you need to re-add controls on each hit, and they need to be done before the viewstate is loaded (I have mine in the Init). Honestly, after doing a site where the main page does a lot of dynamic loading, I'd avoid it if at all possible.

I have found the same. One would think that this is a common request and would be easier to do. I guess after I figured it out it wasn't that bad, but it would be hard to explain to somebody.
Very fitting: http://xkcd.com/386/
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform