Ever tried to create web controls dynamically and add them to the Controls
collection of the Page class? Most probably, you would have ended up with an
error saying "Control '<control name>' of type '<control type>' must
be placed inside a form tag with runat=server."
doesn't place the dynamically generated controls within the
1. Check your in-front file for the ID of the form
element. For our example, let the ID be "Form1"
2. In your code-behind, use
the following syntax to get a handle to the corresponding HtmlForm
HtmlForm form1 = this.FindControl("Form1") as HtmlForm;
3. Add the dynamically
generated controls to the controls collection of this
form1.Controls.Add(<some control object>);
Voila! It should now work fine.