Data and controls from dynamically added controls is rmoved on Submit

D

David Hubbard

I place an PlaceHolder on a page and add a child control 1 or more times to
it. Then the user enters values and clicks the submit button. When my event
handler is called the controls are not present meaning:

ChildPlaceHolder.Controls.Count

is 0.

I know Page_Load is called before my handler, does that regenerate the page
before I have a chance to get the values in the child controls. If so do I
need to add identifiers to the controls so that I can identify them in
Page_Load to tell what button was pressed and call the appropriate handler
before they are cleared.

Thanks
 
B

Bruce Barker

on the postback, you need to add the controls before the onload event, say
in the oninit event (with the same names), so that they exist to receive
their postback values.

-- bruce (sqlwork.com)
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top