WebControl HTML Rendering

P

paul

Is there a way to retrieve the HTML of a WebControl (ie DataList) after it has been rendered
Let's say the DataList renders the below HTML after it's been databinded

<table id="DataList1" cellspacing="0" border="0" ><tr><td><table border="0" cellspacing="0" width="100%" cellpadding="2"><tr><td valign="top" width="100%" colspan="2"
Product Her
</td></tr></table></table>

What I was hoping for was a property of the DataList (ie DataList1.HTML) which would put the above into a string
No such property seems to exist
I thought maybe an attribute would be it (ie DataList1.Attributes["innerHTML"] but that raises an error

any help is greatly appreciate
thank
pau
 
D

David Jessee

Dim x As New tmpControl()

Dim sw As New System.IO.StringWriter()

Dim htw As New HtmlTextWriter(CType(sw, System.IO.TextWriter))

x.RenderControl(htw)

Dim controlHTML As String = sw.ToString()




paul said:
Is there a way to retrieve the HTML of a WebControl (ie DataList) after it has been rendered?
Let's say the DataList renders the below HTML after it's been databinded.

<table id="DataList1" cellspacing="0" border="0" ><tr><td><table
border="0" cellspacing="0" width="100%" cellpadding="2"> said:
Product Here
</td></tr></table></table>

What I was hoping for was a property of the DataList (ie DataList1.HTML)
which would put the above into a string.
No such property seems to exist.
I thought maybe an attribute would be it (ie
DataList1.Attributes["innerHTML"] but that raises an error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top