I have multiple update panels in User controls and it cause page to go to start after each asynchronous postback. By adding this code, I am able to handle the Problem I am facing.
the code in script tag is:
var xpos, ypos;
function windowScroll() {
xpos = document.body.parentNode.scrollLeft; //window.scrollX is not compatible with IE 6
ypos = document.body.parentNode.scrollTop; //window.scrollY is not compatible with IE 6
}
function pageLoaded(sender, args) {
window.scrollTo(xpos, ypos);
}
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(pageLoaded);
window.onscroll = windowScroll;
Adding this code in body section in the end because 'Sys' must have to defined before using this code.
Tuesday, April 21, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment