Click here to Skip to main content
15,917,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<script type="text/javascript">
    var xPos, yPos;
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_beginRequest(BeginRequestHandler);
    prm.add_endRequest(EndRequestHandler);
    function BeginRequestHandler(sender, args) {
        xPos = $get('scrollDiv').scrollLeft;
        yPos = $get('scrollDiv').scrollTop;
    }
    function EndRequestHandler(sender, args) {
        $get('scrollDiv').scrollLeft = xPos;
        $get('scrollDiv').scrollTop = yPos;
    }
 
How to refer a div to this Javascript.. This script place in MASTER PAGE AND I WANT THIS TO INVOKE IN WEB FOR HOW CAN I REFER A DIV TO THIS SCRIPT.

Link of this source :<a href="http://weblogs.asp.net/andrewfrederick/maintain-scroll-position-after-asynchronous-postback">http://weblogs.asp.net/andrewfrederick/maintain-scroll-position-after-asynchronous-postback</a>[<a href="http://weblogs.asp.net/andrewfrederick/maintain-scroll-position-after-asynchronous-postback" target="_blank" title="New Window">^</a>]
Posted
Comments
TheKarateKid 2-Feb-15 17:05pm    
Have you tried using this code in unobtrusive js file and add link of that file in master page? Also, you might want to add logic to handle null references of Sys and prm the reason is that, you may not have 'scrollDiv' always available in the DOM

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900