Hi,

I'm getting the following error message when trying to run my aspx page....

Control 'drddropDown1' of type 'DropDownList' must be placed inside a form tag with runat=server

Basically, I'm trying to reponse.write a control on to the page.

It happens on the drddropDown1.RenderControl(myHtmlTextWriter)
code.

I dropped a dropdownlist control into a webpage(aspx), and then I call the function below with the control as an argument. Here is the code...

a Code:
  1. Public Function BuildAndDisplay(ByRef drddropDown1 As DropDownList)
  2.  
  3.  
  4.        'I do stuff here, where I add items to the dropdownlist control
  5.  
  6.  
  7.         Dim myTextWriter As New System.IO.StringWriter
  8.         Dim myHtmlTextWriter As New System.Web.UI.HtmlTextWriter(myTextWriter)
  9.         drddropDown1.RenderControl(myHtmlTextWriter)
  10.         HttpContext.Current.Response.Write(myTextWriter.ToString)
  11.  
  12.  
  13.     End Function

I'm baffled. I'm not sure what I'm doing wrong. :-(
My other concern, is if I get this to work, while I be able to get a postback on an event.

Any help is greatly appreciated. Let me know if you need more info from me.