This code shows how you can change the html before being rendered in asp.net
protected override void Render(HtmlTextWriter writer)
{
using(System.IO.MemoryStream msHTML = new System.IO.MemoryStream())
{
using(System.IO.StreamWriter swHTML = new System.IO.StreamWriter(msHTML))
{
HtmlTextWriter ourWriter = new HtmlTextWriter(swHTML);
base.Render(ourWriter);
ourWriter.Flush();
msHTML.Position = 0;
using(System.IO.StreamReader oReader = new System.IO.StreamReader(msHTML))
{
string sTxt = oReader.ReadToEnd();
sTxt = sTxt.Replace("pattern", DateTime.Now.ToString());
Response.Write(sTxt);
oReader.Close();
}
}
}
}
No comments:
Post a Comment