Private Sub RetainScrollPosition()Dim saveScrollPosition As New StringBuilderDim setScrollPosition As New StringBuilderRegisterHiddenField("__SCROLLPOS", "0")saveScrollPosition.Append("<script language='javascript'>")saveScrollPosition.Append("function saveScrollPosition() {")saveScrollPosition.Append(" document.forms[0].__SCROLLPOS.value = thebody.scrollTop;")saveScrollPosition.Append("}")saveScrollPosition.Append("thebody.onscroll=saveScrollPosition;")saveScrollPosition.Append("</script>")RegisterStartupScript("saveScroll", saveScrollPosition.ToString())If (Page.IsPostBack = True) ThensetScrollPosition.Append("<script language='javascript'>")setScrollPosition.Append("function setScrollPosition() {")setScrollPosition.Append(" thebody.scrollTop = " & Request("__SCROLLPOS") & ";")setScrollPosition.Append("}")setScrollPosition.Append("thebody.onload=setScrollPosition;")setScrollPosition.Append("</script>")RegisterStartupScript("setScroll", setScrollPosition.ToString())End IfEnd SubPrivate Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadRetainScrollPosition()End Sub