Post-render parsing

Last post 07-25-2004 12:33 AM by MHP. 4 replies.

Sort Posts:

  • Post-render parsing

    07-12-2004, 1:53 PM
    • Member
      45 point Member
    • h0ckey09
    • Member since 07-12-2004, 12:40 PM
    • Dayton, OH
    • Posts 9
    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
  • Re: Post-render parsing

    07-12-2004, 9:47 PM
    • Contributor
      4,745 point Contributor
    • bdesmond
    • Member since 06-15-2002, 6:02 PM
    • Chicago, IL USA
    • Posts 944
    • TrustedFriends-MVPs
    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?
    --Brian Desmond
    Windows Server MVP - Directory Services
    http://www.briandesmond.com
  • Re: Post-render parsing

    07-13-2004, 11:00 AM
    • Member
      45 point Member
    • h0ckey09
    • Member since 07-12-2004, 12:40 PM
    • Dayton, OH
    • Posts 9
    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
  • Re: Post-render parsing

    07-13-2004, 1:54 PM
    • Contributor
      4,745 point Contributor
    • bdesmond
    • Member since 06-15-2002, 6:02 PM
    • Chicago, IL USA
    • Posts 944
    • TrustedFriends-MVPs
    This sounds like an excellent plan.
    --Brian Desmond
    Windows Server MVP - Directory Services
    http://www.briandesmond.com
  • Re: Post-render parsing

    07-24-2004, 11:09 PM
    • Participant
      1,375 point Participant
    • MHP
    • Member since 10-09-2003, 7:51 AM
    • Ottawa, Canada
    • Posts 275
    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.
    -MHP
Page 1 of 1 (5 items)