Dynamic controls can't be accessed?

P

Phuff

Okay, I know that the page load is the best place to do this, but I
have to add my controls inside a button click. Anyway, I tried using a
placeholder and that was no go. Why will asp not keep the dynamically
added controls in the viewstate?!?!? It is so very frustrating. Leave
up to M$ to be counter-intuitive.
 
M

Mark Fitzpatrick

You have to add things in the right order. Keep in mind, the viewstate is
only loaded at certain times so you may not have access to the items because
the viewstate hasn't been re-created. Another thing to keep in mind is
you'll need to re-create the controls to ensure that the viewstate has an
object to load into.

There are some custom controls out there that can help you though. One of
them is a dynamic placeholder that stores child control viewstates
automatically.
http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx I
haven't used it in a long time, but it was very useful for one project I
did.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top