locked
Post-render parsing RRS feed

  • Question

  • User1635150153 posted
    Help! I am working on a control that will search for tooltips (In the title attribute) in the post-rendered output stream for a common phrase (such as Tip: 203) and replace that with information from a database. Once the page is sent, javascript will then take over and produce help popup boxes on my forms. My problem is tapping into the output stream after the page has been rendered. From there it should do it's replaces, and then feed to modified stream back to the client. Any help or suggestions are greatly appreciated. -Derek
    Monday, July 12, 2004 1:53 PM

All replies

  • User1297008538 posted
    Derek- I believe you'll need to do this in the global.asax file. The PreSendRequestContent event is the right stage fo ryou to read the Response.Outputstream property and modify it as applicable. Does this help?
    Monday, July 12, 2004 9:47 PM
  • User1635150153 posted
    Thanks for the suggestion Brian. There is one more piece of functionality that i would like to have which that method did not allow, which is selective replacements based on the page. Some of the pages on the site should not have the enhanced tooltips. I initially started out by building a server control, but i could only access the render block of itself, and not the page outputstream. I found an article on how to capture the output via the Render block of the page itself, but that would be a hassle to add this code to all pages, and newly created ones. My idea then is to create a inherited web.ui.page class with a "RenderToolTips" property, and build the code right into the Render event. I have not done any work on modifying the page class, do you think think is a fesiable idea? http://west-wind.com/weblog/posts/481.aspx
    Tuesday, July 13, 2004 11:00 AM
  • User1297008538 posted
    This sounds like an excellent plan.
    Tuesday, July 13, 2004 1:54 PM
  • User1651711768 posted
    Better override Tooltip property of the control itself to read it from the database. If you are localizing the Tooltip, as an alternative to Database, you can also use "Resource" files which will be faster than retrieving it from the database.
    Saturday, July 24, 2004 11:09 PM