In general, many people use pages to control browser scroll bars. smartNavigation = False. For the scroll bar control of DIV in the page, I wrote one after reading other people's code for reference only:
Copy codeCode: Public Shared Sub SaveDivScrollPosition (ByVal divIDArray As String, ByVal objPage As Page)
Dim saveScrollPosition As String
Dim I As Integer
Dim divID () As String
DivID = divIDArray. Split (",")
For I = 0 To divID. Length-1
ObjPage. RegisterHiddenField (divID (I) & "_ SCROLLPOS", objPage. Request. Form (divID (I) & "_ SCROLLPOS "))
SaveScrollPosition = "<script language = 'javascript '> "_
& "Function saveScrollPosition (){"_
& "If (document. all ['" & divID (I) & "']! = Undefined ){"_
& "Document. forms [0]." & divID (I) & "_ SCROLLPOS. value = "_
& "Document. all ['" & divID (I) & "']. scrollTop + ','"_
& "+ Document. all ['" & divID (I) & "']. scrollLeft ;}}"_
& "If (document. all ['" & divID (I) & "']! = Undefined) {document. all ['"& divID (I) &"']. onscroll = saveScrollPosition ;}"_
& "</Script>"
ObjPage. RegisterStartupScript ("saveScroll" & divID (I), saveScrollPosition)
Next
End Sub
Copy codeCode: Public Shared Sub RestoreDivScrollPosition (ByVal divIDArray As String, ByVal objPage As Page)
Dim restoreScrollPosition As String
Dim setPositionFunction As String
Dim I As Integer
Dim divID () As String
DivID = divIDArray. Split (",")
For I = 0 To divID. Length-1
SetPositionFunction = setPositionFunction & "SetScrollPosition ('" & divID (I )&"');"
Next
RestoreScrollPosition = "<script language = 'javascript '> "_
& SetPositionFunction _
& "</Script>"
ObjPage. RegisterStartupScript ("restoreScroll", restoreScrollPosition)
End Sub
JAVASCRIPT:Copy codeThe Code is as follows: function SetScrollPosition (divID ){
Var e;
Var;
Var obj;
If (document. getElementById (divID )){
Obj = eval ('document. forms [0]. '+ divID +' _ SCROLLPOS ');
If (obj ){
E = eval ('document. forms [0]. '+ divID +' _ SCROLLPOS '). value;
A = e. split (',');
Document. getElementById (divID). scrollTop = a [0];
Document. getElementById (divID). scrollLeft = a [1];
}
}
}
When calling the page in the background, write the following code:Copy codeThe Code is As follows: Private Sub Page_Load (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles MyBase. Load
Call SaveDivScrollPosition ("div1, div2, div3", me)
Call RestoreDivScrollPosition ("div1, div2, div3", me)
End Sub
Sorry, the two SUB can be written as one for your reference only.