Web.UI.Control -> String (HTML Code)
-
Hi, Is there a way, to get HTML codage in a String object from a Web.UI.Control ? For exemple, I buil a simply Table :
Table maTable = new Table();
and I want to get the HTML Code :
String tableHTML = maTable.??? // return "<table ... > ... </table>"
PS : I'm french, so sorry for my english
-
Hi, Is there a way, to get HTML codage in a String object from a Web.UI.Control ? For exemple, I buil a simply Table :
Table maTable = new Table();
and I want to get the HTML Code :
String tableHTML = maTable.??? // return "<table ... > ... </table>"
PS : I'm french, so sorry for my english
you can use rendercontrol method provided for each control try following code Table ctrl = new Table() StringBuilder sb = new StringBuilder(); StringWriter swrt = new StringWriter(sb); HtmlTextWriter ht = new HtmlTextWriter(swrt); ctrl.RenderControl(ht); TextWriter txt = ht.InnerWriter; String strHTML = txt.ToString();
Thanks & Regards Pete