Forum Index

No notifications
Notifications

Favorites

No favorites found
Ask the community Need help to achieve something? - Ask the Community
Subscribe to post
User avatar
andrew.matthews - (21/11/2016 09:14:24)
RE:What happen in the background after a button click?

Hi Arun,

As you've noticed, javascript event handlers will drop off when your model posts back to the webserver. This can be fixed by making use of the following script, in this example the window will scroll back to the top when a button with the style 'kk_ButtonScrollToTop' is clicked:

<script>
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args) {
    if (args.get_error() == undefined) {
        SetClientBindings();
    }                   
}

function SetClientBindings() {
    /* Replace this with your script
    
    $(".kk_ButtonScrollToTop").click(function() {
        $("html,body").animate({scrollTop:0},500);
    });
    
    */
}

SetClientBindings();
</script>

If you have any other questions about this, please don't hesitate to ask.

Thanks,

Andy

RSS Feed