Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamically Adding User Controls
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00863033
Message ID:
00863038
Vues:
9
Brian,

Here's what I've recommended to others in this situation. Check out,

http://www.fawcette.com/vsm/2003_04/magazine/columns/aspnet/

It's a kind of complicated way to add user controls dynamically, but for maintaining state it works great. I was stuck on this very same thing several months ago and this saved the day. Unfortunately, at the time, I was simply researching how to do this for future use and I haven't revisited the concept since then ... so I don't remember squat about it ... except that it worked how I needed it to work.

~~Bonnie


>I am having some difficulty working with dynamically-added user controls and maintaining their viewstate. Hopefully someone can help me out...
>
>I have a web form on which I have an "Add" button that adds a specific user control to a Panel whenever it's clicked. That is, it creates multiple instances of the same user control. The user control contains various web controls, such as textboxes and dropdown lists. I seem to have figured out how to add the user controls dynamically, but only the textboxes maintain their state, not the dropdowns. When I choose an item from a dropdown in one of the user controls, then click "Add" to create another user control, the dropdown value I chose goes away.
>
>I have EnableViewState on for ALL the dropdowns in the user control. What could be happening? Does anyone have some sample code where you're doing the same thing?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform