For This to achieve we need to take two hidden fields to store scroll position in between postbacks
First add the following javascript code in head section of page...
<script type="text/javascript">
var hid1,hid2;
function SetDivPosition()
{
hid1=$get('<%=HiddenField1. ClientID %>');
hid2=$get('<%=HiddenField2. ClientID %>');
hid1.value=$get('<%=divScroll. ClientID %>').scrollLeft;
hid2.value=$get('<%=divScroll. ClientID %>').scrollTop;
}
function GetPosition()
{
hid1=$get('<%=HiddenField1. ClientID %>');
hid2=$get('<%=HiddenField2. ClientID %>');
$get('<%=divScroll.ClientID %>').scrollLeft=hid1.value;
$get('<%=divScroll.ClientID %>').scrollTop=hid2.value;
}
script>
Add function on body onload event
<body onload ="GetPosition();">
Add Div code as follows
<div id="divScroll" onclick="SetDivPosition();" style="width:200px; height:400px; overflow:auto;">
Your Code Goes here..
.
.
.
.
<div>
Your Code Goes here..
.
.
.
.
<div>
0 comments:
Respects for your's Questions & Opinions