I have the same problem as in the question Programmatically added User Control does not create its child controls.
After reading the question and answer I changed my code which now looks like this:
foreach (ITask task in tasks)
{
TaskListItem taskListItem = LoadControl(
typeof(TaskListItem),
new object[] {task}
) as TaskListItem;
taskListItem.TaskCompleteChanged += taskListItem_TaskCompleteChanged;
taskListItemHolder.Controls.Add(taskListItem);
}
However, I'm still getting a user control whose child controls haven't been instantiated.
Any idea what I'm doing wrong?
Thanks in advance