HTML Data generated by Server.Controls

L

Lucky

hi guys!
i've got very interesting problem. it is like this.
is it possible to get HTML generated by the server control in code
behind?

i'm developing an asp.net web application where i need to fectch data
in HTML format. The data is rendered by the Data Repeater in Table
format on webpage.

is there any way i can get reder data of data repeater from itself? i
mean is there any method of anyway to get html data from HTML Control?
like GetHTML() or any properties or work around?

i tried with RenderControl() method but i failed.

the HTML Render Data generated by the Data Repeater is this :
<Table>
<tr>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
</tr>
<tr>
<td>Col1</td>
<td>Col2</td>
<td>Col3</td>
</tr>
</Table>

i want this data in code behind.

if anyone know please let me know.

Lucky
 
A

Andrew Morton

Lucky said:
i've got very interesting problem. it is like this.
is it possible to get HTML generated by the server control in code
behind?

i'm developing an asp.net web application where i need to fectch data
in HTML format. The data is rendered by the Data Repeater in Table
format on webpage.

is there any way i can get reder data of data repeater from itself? i
mean is there any method of anyway to get html data from HTML Control?
like GetHTML() or any properties or work around?

You could generate the HTML yourself instead of using a Data Repeater.

Sometimes the ready-made widgets just don't have what you need -
<mini-rant>for example, the asp:image control uses style="..." to set width
and height which is utterly useless to a browser trying to lay out a table
before the image data has been received, so you have to use an asp:label and
build the HTML yourself.<and breathe>

Andrew
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Well it's not common to start with.

A path would be
First check if there is any event that gives you access to the html being
generated (not sure if it does exist)
If not then you will have to use the stream where all the controls write its
client side code. maybe you can replace it with one of your own. (not sure
if possible)

Finally you could derive your control and override the Render method you
will have easy access to the stream of rendered html
 

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

Top