When dealing with the scrollbar problem in the TreeView list, it was found that many popular processing methods did not work, and found that it was not possible to use this popular practice in the master AJAX environment. So self-reliance, with the following code implemented in the master page, using the AJAX environment of the scroll bar after postback is still in place after the problem:
Add this JS on the page:
<script type= "Text/javascript" >
var dispostion = 0;
function Savescroll () {
Dispostion = Tasklistdivid.scrolltop;
}
function Restorescroll () {
Sys.WebForms.PageRequestManager.getInstance (). Add_endrequest (Endrequesthandler);
}
function Endrequesthandler (sender, args) {
Tasklistdivid.scrolltop = dispostion;
}
</script>
Use this div to cover the content (such as the TreeView) that needs this scroll bar.
<div id= "Tasklistdivid" >
Scroll bar content such as TreeView
</div>
In the background CS code is handled as:
This code in order to handle the problem of scroll bar reset start
Scriptmanager.registeronsubmitstatement (this. Page, this. Page.gettype (), "Savepanelscroll", "Savescroll ();");
if (this. IsPostBack)
{
Scriptmanager.registerstartupscript (this. Page, this. Page.gettype (), "Setpanelscroll", "Restorescroll ();", true);
}
End
Note: var dispostion = 0; In the role of Ajax UpdatePanel, it is not reset because of the postback page.
In addition: I implemented this in the ascx, because the use of Ajax pages need ScriptManager, and in the master page has been used, can not be repeated to add the same, so the use of its proxy version.
<asp:scriptmanagerproxy id= "ScriptManagerProxy1" runat= "Server" >
</asp:ScriptManagerProxy>