maintainscrollposition not maintaining scroll position

hi all, i've got an intranet page displaying sortable gridview that is being refreshed every 10 minutes.  i've added maintainscrollposition header, but when page refreshes, not only does the user get sent back to top of page, they also lose their sort selection.

sort is being done in gridview using session state variable.  page is posted when user selects a value from atuopostback drop down list (day/week/month/year).  strange thing is when the user sorts by column b, then selects different time value from day/week/month/year, the sort is maintained upon the page refresh.  but when the page refreshes from the http meta count, i lose the sort and page position.

how do i maintain page position and sort when using the refresh method below???

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" EnableViewState="false" MaintainScrollPositionOnPostback="true" %>

<head id="Head1" runat="server">
    <title>Realtime Sales</title>
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="expires" content="-1" />
    <meta http-equiv="refresh" content="15" />
</head>


codebehind
protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Session["TimeFrameIndex"] != null)
            {
                TimeFrame.SelectedIndex = (int)Session["TimeFrameIndex"];
                TimeFrame_SelectedIndexChanged((object)Session["sender"], (EventArgs)Session["e"]);
            }
            Session["COLUMN_SORT_NAME"] = "APP PREMIUM";
            Session["COLUMN_SORT_ORDER"] = "DESC";
        }
        GetData();
    }


thanks
aaalifeAsked:
Who is Participating?
 
RejojohnyCommented:
>>i need to know how to maintain scroll/position upon the 10 minute page refresh
am not sure thats possible using meta refresh .. when u click on "retry" after u "refresh" the page, u r actually submitting the page again using the same parameters as ur previous refresh .. that the reason y it maintains the sort and scroll position .,.

Rejo
0
 
RejojohnyCommented:
when a page is refreshed using the meta tag .. it is not submitting the page .. but just refreshing .. so for the server the page is been requested for the first time .. thats the reason why it does not maintain the scroll or the sort position ..

u could give this a try ...

instead of meta refresh u could use "settimeout" to call a function which will submit the page every 10 minutes ..

window.setTimeout("MyFunction", 600);

function MyFunction
{
  document.all.submit();
}
0
 
aaalifeAuthor Commented:
that's worse.  upon refresh i get a pop up window saying "page cannot be refreshed without resending information - click retry to send info again, or cancel", then i lose sort and position.

0
 
RejojohnyCommented:
refresh will popup that message if previous action to that page was a "postback" ... its the behaviour of the browser ...

>> then i lose sort and position
even when u click on "retry"?

Rejo
0
 
aaalifeAuthor Commented:
when i click refresh in browser, scroll position and sort are maintained, this is after clicking ok on retry? box.  i need to know how to maintain scroll/position upon the 10 minute page refresh.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.