Data and controls from dynamically added controls is rmoved on Submit

  • Thread starter Thread starter David Hubbard
  • Start date Start date
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
 
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)
 
Back
Top