Forum Index

No notifications
Notifications

Favorites

No favorites found
Ask the community Need help to achieve something? - Ask the Community
Join the Conversation > Ask the community > What happen in the background after a button click? View modes: 
User avatar
KnowledgeKube Staff
KnowledgeKube Staff
andrew.matthews - 23/11/2016 11:43:44
   
RE:What happen in the background after a button click?

Hi Arun,

Glad to hear that's working for you! You shouldn't have to put your code in the SetClientBindings() function as this will function in a similar way. However SetClientBindings will allow for more functionality in the future if this is required?

Thanks,

Andy


User avatar
Advanced member
Advanced member
Arun Murthy - 23/11/2016 00:51:00
   
RE:What happen in the background after a button click?

Hi Andy,

It worked now. =)

For clicking i use the below (and it work without putting inside the SetClientBindings() function):

$( "body" ).on( "click", ".kk_ButtonScrollToTop", function() {
    alert("The button was clicked. Scoll to top.");
});

Do I still need put it inside the SetClientBindings() function?

Thanks.


User avatar
KnowledgeKube Staff
KnowledgeKube Staff
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


1 2
RSS Feed