Cancelling logout server event

4 posts, 0 answers
  1. Katya
    Katya avatar
    21 posts
    Member since:
    May 2013

    Posted 23 May 2013 Link to this post

    Hi Telerik,

    On Clicking the logout button, I am displaying a confirm box. If the user press yes, then logged out. I tried the following code in the OnClientClicked event but I am getting some sort of JavaScript error in IE. In Firefox nothing happen. Please inspect the below code and guide me.
    function OnClientClicked(sender, eventArgs)
    {
        eventArgs.set_cancel(!confirm("Confirm logout?"));
    }

    Thanks to all,
    Katya
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 May 2013 Link to this post

    Hi Katya,

    Try the same JavaScript code in the OnClientClicking client side event of the RadButton and it will work as expected. You are getting an error in IE because the eventArgs of OnClientClicked event does not have a set_cancel method.

    JavaScript:
    <script type="text/javascript">
        function OnClientClicking(sender, eventArgs) {
            eventArgs.set_cancel(!confirm("Confirm logout?"));
        }
    </script>


    Thanks,
    Shinu,
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Katya
    Katya avatar
    21 posts
    Member since:
    May 2013

    Posted 27 May 2013 Link to this post

    Thanks. Got it working. But how those events differ, I didnt get? Can you make it clear?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 May 2013 Link to this post

    Hi,

    Please have a look at this documentation on RadButton client side events.

    Thanks,
    Shinu.
Back to Top