OK...I got it after I took a minute to look at that code example...
Here's how to control the scrolling position of a DIV with STYLE=overflow: scroll;
In your code behind:
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RegisterHiddenField("__SCROLLLOC", "0")
SaveScrollLocation.Append("<script language='javascript'>")
SaveScrollLocation.Append("function SaveScrollLocation () {")
SaveScrollLocation.Append(" document.forms[0].__SCROLLLOC.value = divname.scrollTop;")
SaveScrollLocation.Append("}")
SaveScrollLocation.Append("divname.onscroll=SaveScrollLocation ;")
SaveScrollLocation.Append("</script>")
RegisterStartupScript("saveScroll", SaveScrollLocation.ToString())
If Not Page.IsPostBack Then
Else
SetScrollLocation.Append("<script language='javascript'>")
SetScrollLocation.Append("function SetScrollLocation () {")
SetScrollLocation.Append(" divname.scrollTop=" & Request("__SCROLLLOC") & ";")
SetScrollLocation.Append("}")
SetScrollLocation.Append("thebody.onload=SetScrollLocation;")
SetScrollLocation.Append("</script>")
RegisterStartupScript("setScroll", SetScrollLocation.ToString())
End If
End Sub
and in your HTML:
Code:
<html>
<head><title>Example</title>
</head>
<body id="thebody">
<form id="Form1" method="post" runat="server">
<div id="divname" style="overflow: scroll;">
Your content goes here...it will scroll and keep the scroll position on postback...
</div>
</body>
</html>
Thanks Planoie...
-------------------------
Beware of programmers with screwdrivers...