Click event from JavaScript

2 posts, 0 answers
  1. Chaitanya
    Chaitanya avatar
    3 posts
    Member since:
    Jun 2012

    Posted 31 Aug 2012 Link to this post

    In our application we are trying to assign shortcut keys for options on the screen,
    which requires us to trap keys on client side and accordingly call .click() event of targetted control.
    We have some validations set for all these controls in OnClientClicking event.
    According to validation conditions we have to stop postback by setting arguments.setCancel(true). Also, on some places we 
    need to open rad window pop up after setting postback false.

    Issue that we are facing is when we fire click event of these controls using mouse OnClientClicking is being called, but
    when we are trying to achieve same by firing .click() from javascript for short cut keys functionality, OnClientClicking is not getting

    Please let me know if you have any solution for this. Or some other way to achieve our functionality.
  2. Slav
    Slav avatar
    1359 posts

    Posted 04 Sep 2012 Link to this post

    Hello Chaitanya,

    Truly, when click event of RadButton is called programmatically via the .click() method, the OnClientClicking event is not fired, which is the expected behavior. Nevertheless, you can easily accomplish your scenario without this event. My suggestion is to insert a confirm dialog check before the client-side click takes place as the example below demonstrates:
    function ProgramClick() {
        var btn = $find("<%=myButton.ClientID %>");
        if (confirm('Ok to continue this action?')) {

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top