While I'm having some success with this, I am seeing some behavior that doesn't make sense. I need to create a number of controls based on the number of rows in a DataTable. My page lies within a ContentPlaceHolder inside a Master Page. Reason I mention that is that appears to factor into the confusion. While I know that there are caveats when creating controls on Page Load, I am not doing that in this case, I am creating the controls on the Click event of a button.
The following is my code and a screenshot of the results. Ideas? Thanks.
Dim tbl As DataTable = EvalQuestions.GetEvalQuestionsByParams(ddlEvalPeriods.SelectedValue, ddlEvalGroups.SelectedValue)
For Each r As DataRow In tbl.Rows
Dim ctl As New TextBox
ctl.ID = Guid.NewGuid().ToString()
pnQuestions.Controls.Add(ctl)
ctl.Text = pnQuestions.Parent.ID.ToString
Next r
pnQuestions.Visible = True
Go to the complete details ...