New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

OnClientClicked

The clicked event is subsequent to the checkedChanged event, and occurs when the RadSwitch control is clicked. The event is fired after the client-side validation is completed (just like the PushButon's OnClientClicked event), just before the page is submitted, and cannot be canceled.

The event handler receives two parameters:

  1. The instance of the clicked RadSwitch control.

  2. An eventArgs parameter of type Telerik.Web.UI.ButtonEventArgs, containing the following properties and methods:

    • get_commandName() - returns the value assigned to the RadSwitch's CommandName property.

    • get_commandArgument() - returns the value assigned to the RadSwitch's CommandArgument property.

This event can be used in scenarios where you need custom client-side code to be executed when the switch is clicked.

Example 1: Handling the OnClientClicked event.

<script type="text/javascript">
    function clientClick(sender, args) {
        var value = sender.get_value();
        $get("<%= Textbox1.ClientID %>").value = value;
    }
</script>

<span> Value:</span>
<asp:TextBox ID="Textbox1" runat="server" />

<telerik:RadSwitch ID="RadSwitch1" runat="server" AutoPostBack="false" Value="1"
    OnClientClicked="clientClick">
</telerik:RadSwitch>

See Also

In this article