Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Nov 26, 2009 @ 13:06
    Sebastiaan Janssen
    0

    Using values across macro's in the same page

    I have a few pages that need to use a value in three seperate macro's. The values I have to get programatically. Currently I am actually doing three calls to the same method, which is obviously an incredible waste.

    I was thinking of getting the values only once, and in hooking into the Prerender event to add the values to the HttpContext,Items collection. 

    The thing I haven't yet figured out though is.. how do I get into the Prerender event, as my user controls are being called during the rendering of the page..

    Any ideas? Is there maybe an alternative method that I'm missing here?

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Nov 26, 2009 @ 13:45
    Lee Kelleher
    0

    Sebastiaan,

    Are you able to modify the method that you are calling (3 times)?  If so, then on first call, add the result to a HttpContext Item, then on subsequent calls check if the HttpContext Item has a value, and return that.

    If you can't modify the method ... then how's about writing a wrapper method for it? Which only deals with the caching/HttpContext Item?

    Good luck, Lee.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies