MaintainScrollPositionOnPostback = true
its working with IE but not with mozilla(version 9)
suggest another way of maintaining scroll position that is browser independent..
thanxx
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Found the answer here:
and here:
http://www.4guysfromrolla.com/articles/111704-1.aspx
Let me know if it works out for you!
EDIT
Since I just had link answers I am actually just going to paste the code snippets here in case those links disappear:
<script type="text/javascript">
var xPos, yPos;
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(BeginRequestHandler);
prm.add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args) {
xPos = $get('scrollDiv').scrollLeft;
yPos = $get('scrollDiv').scrollTop;
}
function EndRequestHandler(sender, args) {
$get('scrollDiv').scrollLeft = xPos;
$get('scrollDiv').scrollTop = yPos;
}
</script>
From: http://www.4guysfromrolla.com/articles/111704-1.aspx
<script language = "javascript">
function sstchur_SmartScroller_GetCoords()
{
var scrollX, scrollY;
if (document.all)
{
if (!document.documentElement.scrollLeft)
scrollX = document.body.scrollLeft;
else
scrollX = document.documentElement.scrollLeft;
if (!document.documentElement.scrollTop)
scrollY = document.body.scrollTop;
else
scrollY = document.documentElement.scrollTop;
}
else
{
scrollX = window.pageXOffset;
scrollY = window.pageYOffset;
}
document.forms[formID].xCoordHolder.value = scrollX;
document.forms[formID].yCoordHolder.value = scrollY;
}
function sstchur_SmartScroller_Scroll()
{
var x = document.forms[formID].xCoordHolder.value;
var y = document.formsformID].yCoordHolder.value;
window.scrollTo(x, y);
}
window.onload = sstchur_SmartScroller_Scroll;
window.onscroll = sstchur_SmartScroller_GetCoords;
window.onkeypress = sstchur_SmartScroller_GetCoords;
window.onclick = sstchur_SmartScroller_GetCoords;
<script>
All the credit to the guys that worked hard on these answers.
Method 2
I just ran into the same problem on a legacy code base. Updating the .NET Framework from 3.5 to 4.7 cleared it up for me.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0