No, scratch that - I've found a better way! :)
Include this JS function in your page:
function resetDotNetScrollPosition()
{
var scrollX = document.getElementById('__SCROLLPOSITIONX');
var scrollY = document.getElementById('__SCROLLPOSITIONY');
if(scrollX != null && scrollY != null)
{
scrollX.value = 0;
scrollY.value = 0;
}
}
then in whichever server event you need to reset the scroll position, register it as a startup script:
Page.ClientScript.RegisterStartupScript(Page.Clien tScript.GetType(), Page.ClientID, "resetDotNetScrollPosition();", true);
...it works because this startup script gets inserted *before* ASP.NET's calls to restore the scroll position, so it ends up restoring the scroll position to 0,0. Here is the generated HTML from the end of my page:
------------------------------------------------
resetDotNetScrollPosition(); << LOOK!
theForm.oldSubmit = theForm.submit;
theForm.submit = WebForm_SaveScrollPositionSubmit;
theForm.oldOnSubmit = theForm.onsubmit;
theForm.onsubmit = WebForm_SaveScrollPositionOnSubmit;
theForm.oldOnLoad = window.onload;
window.onload = WebForm_RestoreScrollPosition;
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com