Refresh check not working

Discussion in 'ASP .Net' started by tshad, Aug 21, 2006.

  1. tshad

    tshad Guest

    I got a piece of code to check if a Web page was refreshed (user pressed
    refresh button).

    But I can't get it to work.

    The code is:
    ************************************************************
    namespace StevenBey.Web.UI
    {
    public class Page : System.Web.UI.Page
    {
    private bool _refreshState;
    private bool _isRefresh;

    public bool IsRefresh
    {
    get
    {
    return _isRefresh;
    }
    }

    protected override void LoadViewState(object savedState)
    {
    object[] allStates = (object[]) savedState;
    base.LoadViewState(allStates[0]);
    _refreshState = (bool) allStates[1];
    _isRefresh = _refreshState == (bool) Session["__ISREFRESH"];
    }

    protected override object SaveViewState()
    {
    Session["__ISREFRESH"] = _refreshState;
    object[] allStates = new object[2];
    allStates[0] = base.SaveViewState();
    allStates[1] = !_refreshState;
    return allStates;
    }
    }
    }
    ************************************************************

    If I do a:

    trace.warn("is Refresh = " & Page.IsRefresh)

    or

    trace.warn("is Refresh = " & IsRefresh)

    I get the error:

    BC30456 'IsRefresh' is not a member of 'System.Web.UI.Page'

    I took the compiled version (StevenBey.Web.UI.dll) and put it in my Bin
    directory.

    If you look at trace page you won't see __ISREFRESH?

    Is there something else I need to do to get this to work?

    Thanks,

    Tom
     
    tshad, Aug 21, 2006
    #1
    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. brian lanning
    Replies:
    0
    Views:
    632
    brian lanning
    Jul 29, 2003
  2. ujjc001
    Replies:
    2
    Views:
    4,484
    ujjc001
    Jul 28, 2005
  3. Per Magnus L?vold
    Replies:
    1
    Views:
    5,214
    John C. Bollinger
    Oct 8, 2004
  4. Pkenty
    Replies:
    0
    Views:
    436
    Pkenty
    May 28, 2004
  5. Jawahar Rajan
    Replies:
    1
    Views:
    312
    Adrienne
    Oct 1, 2003
Loading...

Share This Page