>How do you add a textbox to an asp page?
>
>When I try this:
>
>
> TextBox TextBox1 = new TextBox();
> this.Controls.Add(TextBox1);
>
>
>I get a page error "Control 'ctl02' of type 'TextBox' must be placed inside a form tag with runat=server. "
>
>Is there no way to do this in C# in the page_load? Or must I do it with tags?
You are trying to add it to the Page (I assume that's what 'this' is?)
Add it instead to the element which will contain it. For example using the default webform generated by VS:
form1.Controls.Add(TextBox1);