Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Controls collection
Message
 
À
17/03/2009 09:05:19
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
Divers
Thread ID:
01388377
Message ID:
01388681
Vues:
27
>>
>>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.

The "why" of all of it makes sense, it's just difficult to understand all the various events and when they fire. Actually, this is a reason why a lot of people like the new ASP.NET MVC framework. Adding the controls are easy enough, it just doesn't make any intuitive sense that you have to reload them on each page hit, just to unload those same controls a second later (just to make viewstate happy). Instead of:

- Page is hit, load control 1
- User clicks on something
- Postback, in response to click load control 2

You end up with something that looks like this:

- Page is hit, load control 1
- User clicks on something
- Reload control 1
- Postback, in response to click unload control 1 and load control 2

It's just weird.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform