0

I've some problem when I want to scroll after postback with asp.net. if I try like this, it doesn't work but when I add an alert(posYDoc) before $(window).scrollTop(yPosDoc) in EndRequestHandler it's working perfectly and position in alert is ok.

    var yPosDoc;
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_beginRequest(BeginRequestHandler);
    prm.add_endRequest(EndRequestHandler);

    function BeginRequestHandler(sender, args) {
        yPosDoc = $(window).scrollTop();
    }
    function EndRequestHandler(sender, args) {
        $(window).scrollTop(yPosDoc);
    }

Anyone can help me ? Thank you !

  • You should state your question a bit more clearly. Instead of just saying "I have a problem" and "it doesn't work," state what it is you are trying to achieve and what specifically is happening when you try the code you posted. – NoChinDeluxe Oct 21 '15 at 22:01
  • Put an alert into BeginRequestHandler and EndRequestHandler to display the values of yPosDoc. Check if it is the same and not 0 in both occasions. – Don Oct 21 '15 at 22:07
  • You might want to take a look at the link: http://stackoverflow.com/questions/616210/reset-scroll-position-after-async-postback-asp-net – Hatjhie Oct 22 '15 at 03:25
  • When i use alert(yPosDoc) just before $(window).scrollTop(yPosDoc); it's working but when alert is not here $(window).scrollTop(yPosDoc); not works. – Mickel Bernier Oct 22 '15 at 18:12

0 Answers0