I would like to leverage the asp.net WebControl classes (TextBox, CheckBoxList, Button, etc) to build a string that can be parsed into a Control using TemplateControl.ParseControl().
I am using the following code to output HTML from a WebControl:
TextBox control = new TextBox();
StringBuilder sb = new StringBuilder();
HtmlTextWriter objHtml = new HtmlTextWriter(new System.IO.StringWriter(sb));
control.RenderControl(objHtml);
This outputs:
"<input name=\"Phone\" type=\"text\" id=\"Phone\" />"
Is it possible to output the following instead?:
"<asp:Textbox name=\"Phone\" id=\"Phone\" runat=\"server\" />"