When I try to add a dynamically created control to an asp I get a error
<p>When I create a control dynamically and add it to the page's controls collection, I get the following error.  What's going on? How do I add controls to a page dynamically?</p>

<pre><code>Control 'ctl02' of type 'TextBox' must be placed inside a form tag with runat=server.
</code></pre>

<p>I'm doing something like: </p>

<pre><code>protected override void OnPreRender(EventArgs e)
{
    base.OnPreRender(e);
    double total = (double)ViewState[cKeyTotal];
    TextBox txt = new TextBox();
    txt.Text = "hello world";

    this.Controls.Add(txt);
}
</code></pre>
