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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top