HtmlSelect

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to convert a control I created programatically to a string format
so I place the created control to my page. I tried placeholder and it worked
fine, but I need to "render" the control to string format. I'm using
ASP.NET. Here's what I have.

Dim htmlSelect As New HtmlControls.HtmlSelect
htmlSelect.ID = "stage"
htmlSelect.DataSource = ds.Tables("approvalusers")
htmlSelect.DataValueField = "fname"
htmlSelect.DataBind()

' This line below does NOT work
Resonse.Write(htmlSelect)

Thanks!
 
microsoft.public.dotnet.framework.aspnet

Good luck with it.

- Winux P

"Internet Explorer 7 install problem"
: I'm trying to convert a control I created programatically to a string
format
: so I place the created control to my page. I tried placeholder and it
worked
: fine, but I need to "render" the control to string format. I'm using
: ASP.NET. Here's what I have.
:
: Dim htmlSelect As New HtmlControls.HtmlSelect
: htmlSelect.ID = "stage"
: htmlSelect.DataSource = ds.Tables("approvalusers")
: htmlSelect.DataValueField = "fname"
: htmlSelect.DataBind()
:
: ' This line below does NOT work
: Resonse.Write(htmlSelect)
:
: Thanks!
:
:
 
Function cts(ByVal c As Control) As String

Dim sw As New System.IO.StringWriter
Dim tw As New Html32TextWriter(sw)
c.RenderControl(tw)
cts = sw.ToString()

End Function
 
Back
Top