User Control Caching

Discussion in 'ASP .Net' started by Joe Fallon, Oct 25, 2004.

  1. Joe Fallon

    Joe Fallon Guest

    I have a simple user control that I use for the footer of each page.
    It has one line of text with things link comapny name and a few hyperlinks
    to jump to other pages.

    If I want to use partial page caching I could assign this directive to it:

    <%@ OutputCache Duration="60" VaryByParam="none" %>

    Then as each page renders it should pull the already rendered footer from
    cache instead of re-generating it.

    My question is:
    What if I want to hide some of the links on certain pages? e.g. a Popup page
    should not have links on it.
    So for those pages I want the footer to be different.

    I currently have code in the user control to handle this. But that means I
    generate the control for each page.

    I would like to know how to cache the user control for both types of
    windows - normal and popup.
    Obviously, I could build another user control so I could assign the right
    one to each window type.
    But I am looking for a way to do it with 1 control.

    Thanks!
    --
    Joe Fallon
     
    Joe Fallon, Oct 25, 2004
    #1
    1. Advertising

  2. Joe Fallon

    Scott Allen Guest

    Hi Joe:

    Is there a GET or POST parameter that tells the user control how to
    build differently? You could set VaryByParam to that parameter name.

    If that doesn't work, there is always VaryByControl, and VaryByCustom
    when nothing else will do.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Mon, 25 Oct 2004 18:52:55 -0400, "Joe Fallon"
    <> wrote:

    >I have a simple user control that I use for the footer of each page.
    >It has one line of text with things link comapny name and a few hyperlinks
    >to jump to other pages.
    >
    >If I want to use partial page caching I could assign this directive to it:
    >
    ><%@ OutputCache Duration="60" VaryByParam="none" %>
    >
    >Then as each page renders it should pull the already rendered footer from
    >cache instead of re-generating it.
    >
    >My question is:
    >What if I want to hide some of the links on certain pages? e.g. a Popup page
    >should not have links on it.
    >So for those pages I want the footer to be different.
    >
    >I currently have code in the user control to handle this. But that means I
    >generate the control for each page.
    >
    >I would like to know how to cache the user control for both types of
    >windows - normal and popup.
    >Obviously, I could build another user control so I could assign the right
    >one to each window type.
    >But I am looking for a way to do it with 1 control.
    >
    >Thanks!
     
    Scott Allen, Oct 26, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hypo
    Replies:
    6
    Views:
    460
  2. Troy Simpson

    Fragment Caching inside page caching?

    Troy Simpson, Jan 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    843
    Troy Simpson
    Jan 19, 2004
  3. Mad Scientist Jr
    Replies:
    0
    Views:
    674
    Mad Scientist Jr
    Mar 22, 2006
  4. JimLad
    Replies:
    3
    Views:
    948
    JimLad
    Jan 21, 2010
  5. Jonathan Wood

    User Control to Control Other User Control

    Jonathan Wood, Jan 24, 2010, in forum: ASP .Net
    Replies:
    4
    Views:
    580
    Jonathan Wood
    Feb 2, 2010
Loading...

Share This Page