I have a UserControl which dynamically creates several TextBoxes. The number of TextBoxes is dependent on user selection. I chose to store the IDs of each TextBox in the UserControl's ViewState object so that they can be re-created consistently across each postback.
If I re-create the dynamic controls during Page_Init (as is recommended) then the UserControls's ViewState has not yet been populated.
If I re-create the dynamic controls during Page_Load or PreLoad then their postback values are not rehydrated until after the Page_Load event, so I can't access their correct values until later in the page lifecycle which is causing problems.
Is there a better approach to this?