Getting the raw HTML from a web control
Option Strict On Option Explicit On Imports System Imports System.Drawing Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.IO Public Class App1 Shared Sub Main() Dim ctl As TextBox = New TextBox() ctl.BackColor = Color.Red ctl.Height = New Unit(200) Dim sw As StringWriter = New StringWriter() ctl.RenderControl(New HtmlTextWriter(sw)) Console.WriteLine(sw.ToString()) End Sub End Class
When run, you should get the following output in the console window:
<INPUT style="HEIGHT: 200px; BACKGROUND-COLOR: red">