TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Raghavendra U
717
1.3k
444.9k
Keep the scroll position of a DIV after postback
May 5 2009 8:31 AM
<body onload="setScrollPos('myDiv')">
<form id="form1" runat="server">
<div id="myDiv" onscroll="saveScrollPos(this);" style="height:50px; width:100%; overflow:auto;">
...
</div>
<asp:Button runat="server" ID="Button1" Text="Press Me!" />
<input type="hidden" id="scrollPos" name="scrollPos" value="0" runat="server"/>
</form>
<script type="text/javascript" language="javascript">
function saveScrollPos(object)
{
document.getElementById('scrollPos').value = object.scrollTop;
}
function setScrollPos(elementId)
{
document.getElementById(elementId).scrollTop = document.getElementById('scrollPos').value;
}
</script>
</body>
Reply
Answers (
3
)
doubt on directories
Program-driven tab switching in Outlook FormRegion