1

I know how to do this using javascript when I'm doing a postback with this: window.scrollTo(x, y);. But I have a new scenario where I have to return to an exact scroll position a page (page1.aspx) from another page (page2.aspx). I want to be able to get the scroll position of page 1 and store it in a query string of the url for page2 so I can use it to set the scroll position when returning to page1.

I choose to do it in c# as javascript would probably not handle the cross page navigation nicely. I could be wrong though, but I need some help with this. Someone help.

1 Answer 1

0

You can do it in javascript. Just store the value in local storage and clear it when used.

 loadSetting = function (key, value) {
    value = window.localStorage.getItem(key);
    return value;
}

saveSetting = function (key, value, bAuto) {
    window.localStorage.setItem(key, value);
}

clearSetting = function (key) {
    window.localStorage.removeItem(key);
}
1
  • Thanks but I already took a different/better approach and I got what I wanted. Feb 6, 2016 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.