Use a hidden control to save the current scorll value. After return, reset scroll Based on the value of scroll.
1. First, use the onscroll event to save the scorll value and use hiddenfield to record the scroll value.
Copy the Code as follows:
<Div id = "lv_content" class = "unify_content" style = "padding-left: 0; height: 455px;" onscroll = "setscrollposition (this)">
</Div>
<Asp Tutorial: hiddenfield id = "hiddenfieldscroll" runat = "server"/>
Code
// 2. Write an onscroll event to save the scroll value of the current control.
Copy the Code as follows:
Function funsavescroll (sender ){
// Obtain the hidden Control
Var vscroll = $ get ('ctl00 _ contentplaceholder1_hflvscroll ');
If (vscroll! = Null ){
// Set the value of the hidden control to scorll.
Vscroll. value = sender. scrolltop;
}
}
Code
Copy the Code as follows:
// 3. process the scorll value in the page load completion event
Var prm = sys. webforms. pagerequestmanager. getinstance ();
// Set the loading completion event
Prm. add_pageloaded (pageloaded );
// Reset the scroll value of the control after loading.
Function pageloaded (sender, args ){
// Obtain the control for setting the scroll value.
Var vdiv = $ get ("lv_content ");
If (vdiv! = Null ){
// Obtain the hidden Control
Var vscrollvalue = $ get ("ctl00_contentplaceholder1_hflvscroll ");
// Set the scroll value of the control
Vdiv. scrolltop = vscrollvalue. value;
}
} 1 2