This is a migrated thread and some comments may be shown as answers.

Cancelling logout server event

3 Answers 18 Views
Button
This is a migrated thread and some comments may be shown as answers.
Katya
Top achievements
Rank 1
Katya asked on 24 May 2013, 12:48 AM
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

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 24 May 2013, 02:53 AM
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,
0
Katya
Top achievements
Rank 1
answered on 27 May 2013, 10:51 AM
Thanks. Got it working. But how those events differ, I didnt get? Can you make it clear?
0
Shinu
Top achievements
Rank 1
answered on 27 May 2013, 10:57 AM
Hi,

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

Thanks,
Shinu.
Tags
Button
Asked by
Katya
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Katya
Top achievements
Rank 1
Share this question
or