What is a correct way to initiate user control from code behind
<p>Basically I want to create a user control in code behind, DataBind() it and then insert the control into current page</p>

<p>I'm currently trying this:</p>

<pre><code>var comment = new IncidentHistoryGroupComment();
comment.LoadControl("~/Controls/IncidentHistoryGroupComment.ascx");
comment.LoadTemplate("~/Controls/IncidentHistoryGroupComment.ascx");
comment.InitializeAsUserControl(this);
comment.AttachmentActions = group.HastAttachmentActions ? group.AttachmentActions : null;
comment.Comment = group.Comment;
comment.NextStep = group.NextStep;
comment.IsInitiationStep = group.InitializationEntry != null;
comment.DataBind();
</code></pre>

<p>But still all controls inside it are null. For example i have a pane with id pnlComments and when I try to access it in IncidentHistoryGroupComment.DataBind() method I get null. I also checked Controls property to see if there is something there but Controls.Count == 0</p>

<p>So the question is how to correctly initialize a user control from code behind so that all controls would be assigned to their instances in IncidentHistoryGroupComment.designer.cs so I could access them easily.</p>
