Hi,<BR><BR>How can I create web controls programmatically or add web controls to the output of the HTML page? I tried the following but did not work:<BR>............<BR>Sub Page_load()<BR>response.write("<form runat="server"><BR>response.write("<asp:textbox id='mytext' runat='server' />")<BR>response.write("</form>")<BR>End Sub<BR>............<BR>Is there any other way to do this in ASP.net? If so, please show me how to do it.<BR>Many thanks in advance.<BR>GeorgeYou dont create any controls, you just send some text to the client.<BR><BR>There are good samples of this in the quickstart. Basically, you need to INSTANTIATE the controls (with new - no idea how this is exactly one in VB, I only do C#). Then you add them to the Controls collection of the parent.<BR><BR>In this case: The form control to the controls colletion of the page, the textbox to the controls collection of the form.<BR><BR>A good tip for you guys: make a page with stati controls, then add a syntax error. Call the page - you can have full access to the code the compiler sees, and this is nice to see how things work.<BR><BR>Regards<BR><BR>Thomas Tomiczek<BR>THONA Consulting Ltd.I seem to remember - although this may only have been Beta 1 - that there was a problem adding controls to the page like this, and to do it you had to add them to the collection of an existing control. The workaround was, then (I think) to declare a Label and programatically add additional controls to it?<BR><BR>any use?<BR>Create a panel object to hold the controls you want to add.<BR>Then add your objects as needed.<BR><BR>As stated earlier you will need to create instances of your object if it doesn't exist yet.<BR><BR>The main methods used are Panel.Controls.Add and Page.LoadControl<BR><BR>Sub Page_Init(Sender as Object, E as EventArgs)<BR>Dim strPage As String<BR>strPage = trim(request.querystring("page"))<BR>If strPage = "subcategory" Then<BR>body.Controls.Add( Page.LoadControl("subcategory.ascx"))<BR>Else If strPage = "pattern" Then<BR>body.Controls.Add( Page.LoadControl("pattern.ascx"))<BR>...<BR>...<BR>...<BR><BR>Tommy McConnellI found out in QuickStart:<BR><BR>Dim txt as Textbox<BR>Controls.Add(txt)<BR><BR>I am not sure if this is the best way but for now, this serves my purpose. <BR><BR>Many thanks to all the suggestions. They're all very insightful.<BR><BR>George