Events Overview
The RadSplitButton exposes several client-side events which allow easy and flexible use in a wide range of application scenarios:
-
OnClientLoad (load) - raised when the control is initialized.
-
OnClientClicking (clicking) - raised when the user clicks the button. The event can be canceled.
-
OnClientClicked (clicked) - raised when the button is clicked. The event is subsequent to the OnClientClicking event.
-
OnClientMouseOver (mouseOver) - raised when the mouse hovers over the control.
-
OnClientMouseOut (mouseOut) - raised when the mouse leaves the control.
-
OnClientContextMenuItemClicked (contextMenuItemClicked) - raised when an Item from the drop down is clicked.
The ContextMenu embedded in RadSplitButton is fully functional control with its own events that can also be used along with the ones of the SplitButton - Client-side events
To handle the desired event, the user must set the respective property to the name of the JavaScript function handling the event or to anonymous JavaScript function. Here is an example:
Example 1: Passing named (non-anonymous) JavaScript function.
<script type="text/javascript">
function Click(sender, args)
{
alert("RadSplitButton was clicked.");
}
</script>
<telerik:RadSplitButton ID="RadSplitButton1" runat="server" OnClientClicked="Click">
</telerik:RadSplitButton>
RadSplitButton1.OnClientClicked = "Click"; //passing the name of the JS function
Example 2: Passing anonymous JavaScript function.
<script type="text/javascript">
function Click(button, args, arg1, arg2)
{
alert("arg1:" + arg1 + " arg2:" + arg2);
}
</script>
<telerik:RadSplitButton ID="RadSplitButton1" runat="server" OnClientClicked="function(sender,args){Click(sender, args, 'Value1', 'Value2');}">
</telerik:RadSplitButton>
RadSplitButton1.OnClientClicked = "function(sender,args){Click(sender, args, 'Value1', 'Value2');}"; //passing the name of the JS function