Hello,
Firstly, I would suggest using:
Page.MaintainScrollPositionOnPostBack = true;
in your PageLoad event to maintain page position for your whole page.
Now, for the div question. I found a nice solution to your question here:
http://radio.javaranch.com/pascarello/2005/07/18/1121709316718.html[
^]
I changed it a bit so to work with hiddenfield and not cookie. Below is the result.
<script type="text/javascript">
window.onload = function () {
var h = document.getElementById("<%=keep.ClientID%>");
document.getElementById("divTest").scrollTop = h.value;
alert(h.value);
}
function SetDivPosition(){
var intY = document.getElementById("divTest").scrollTop;
var h = document.getElementById("<%=keep.ClientID%>");
h.value = intY;
}
</script>
Below is the starting tag of the div you want to maintain.
<div önscroll="SetDivPosition()" id="divTest">
</div>
Notes:
- "divTest" is the name of the div you wish to maintain
- "keep" is the name of the hidden field I used
Tested with IE 8, Firefox 4 and Chrome 12.
Hope it helps!