After Render

J

Just Me

Does anyone know if one can get to a representation of the rendered page (
after ) render. ?
 
J

John Timney \(MVP\)

Pretty sure whats written in the render event is a representation of the
rendered page

protected override void Render(HtmlTextWriter writer) {

// extract all html and override <h2>News List</h2>
System.IO.StringWriter str = new System.IO.StringWriter();
HtmlTextWriter wrt = new HtmlTextWriter(str);
// render html
base.Render(wrt); //CAPTURE THE CURRENT PAGE HTML SOURCE
wrt.Close();
string html = str.ToString();
//do something with the rendered output
html = html.Replace("<h2>News List</h2>", "<h2>Headlines</h2>");
// write the new html to the page
writer.Write(html);
}

Whatever is in the string html at this point is the rendered page output

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
 

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,774
Messages
2,569,599
Members
45,162
Latest member
GertrudeMa
Top