accessing dynamically created controls

  • Thread starter Sandra Castellanos
  • Start date
S

Sandra Castellanos

Hi,

I have an <asp:table> inside an aspx page, and in the code I am adding
several rows, cells and controls such as listboxes and radiobuttons to it.
When I load the page, I see all the controls that have been created, but
when I submit it, the table is empty again. What do I have to do to access
the controls I created, with the values the user added to it?

Regards,

Sandra Castellanos
 
R

Robert Koritnik

When you dymicly create controls you have to take care of that creation each
time the postback happens. You have to know that page object istance doesn't
persist on the server between postbacsk. YOu only have a feeling it does but
it doesn't. that's why ViewState is used etc... The best way to do this is
to have some properties that get set when a user changes the page. When a
Postback happens in the PageLoad event recreate those controls that you
need. View state will automaticly be restored to those controls that save
it.
 

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

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top