RadAjax losing state change on page back

2 posts, 0 answers
  1. Stephen
    Stephen avatar
    13 posts
    Member since:
    Aug 2008

    Posted 16 Dec 2008 Link to this post

    Hi,

    I have encountered an issue when using RadAjaxManager and now that I have a fix I was thinking that others might be interested.

    A lot of the stuff below is detail - the same scenario is probably applicable with most control combinations.

    The environment is asp.net 2.0 + VS2008 + RadControls Q3 2008 (1125)
    The scenario is as follows...

    1) Page with RadAjaxManager, 2 RadSliders, RadMenu, RadGrid, asp Timer (all ajaxified via RadAjaxManager)
    2) RadMenu command updates the visibility of the RadSliders (shows one hides the other) and Rebinds the grid to display a different range of data.
    3) Timer fires every 5 minutes or in 20 seconds from first page display

    so far so good...
    Now the problem happens like this.

    1) Open the page (page displays in one of two modes depending on value stored in database and reflected in Menu)
    2) Click on Menu to change mode - RadSliders change visibility and RadGrid rebinds ok
    3) Click on page link to go to another page
    4) Click 'Back' button on browser to go back to the first page
    5) First page displays the ORIGINAL MODE (ie the one before the change was made via the Menu) UNTIL the timer fires.
    6) When the timer fires (an ajax request) the display goes back to what it should be (ie the new mode is shown in the visibility of the RadSliders and the data in the RadGrid)

    The issue is that the page is being cached and the caching is not updated as a result of the ajax changes. The fix is to turn off page caching using the following courtesy of  A Thorough Examination of "Disabling the Back Button." By Akhilesh Reddy 

    <%
      Response.Buffer = true;
      Response.ExpiresAbsolute = DateTime.Now - new TimeSpan(0, 0, 1);
      Response.Expires = 0;
      Response.CacheControl = "no-cache";
    %>
    Once that is done everything seems to work fine. The page goes back to the server when the Back button is clicked and the state is correct.

    Cheers
    Steve
  2. Poo Preaw
    Poo Preaw avatar
    1 posts
    Member since:
    Jul 2009

    Posted 25 Dec 2009 Link to this post

    Thanks ;)
Back to Top