I have made an ASP.NET table which on runtime gets populated with labels, literals, data, formatting etc.
form1.innerhtml says page does not have literals only.
I need to extract this ASP.NET table generated at runtime as HTML code so that it can be exported to a Word file..(as Word easily supports HTML) and the browser is also displaying HTML.
So how to get the HTML?
You can render the control into a string.
Edited: Here is a complete .aspx page. All I did is create a new website, put the following code in and hit F5.
The output is
which the browser displays as<span style="color:Red;">This is sample text</span>
<span style="color:Red;">This is sample text</span>.Note that you could also eliminate the StringBuilder, use
new StringWriter();and returntw.ToString();. StringWriter uses a StringBuilder as its underlying data structure anyway.