OnButtonClick
The OnButtonClick client-side event handler is called when the user clicks on a button associated with the input control. This can be the button that is displayed when the ShowButton property is True, or one of the spin buttons that is displayed when the ShowSpinButtons property is True.
Two parameters are passed to the event handler:
-
sender is the input control.
-
eventArgs has the following methods:
-
set_cancel() lets you prevent the default response to the button click.
-
get_buttonType() returns an integer that indicates which button was clicked. The possible values are
-
1
orTelerik.Web.UI.InputButtonType.Button
—The button that appears when the ShowButton property is True. -
2
orTelerik.Web.UI.InputButtonType.MoveUpButton
—The upward spin button. -
3
orTelerik.Web.UI.InputButtonType.MoveDownButton
—The downward spin button.
-
-
Use the OnButtonClick event to provide a client-side response when the user clicks on a button:
<telerik:RadTextBox RenderMode="Lightweight" ID="RadTextBox1" runat="server" ShowButton="True">
<ClientEvents OnButtonClick="ToggleEnabled" />
</telerik:RadTextBox>
<script type="text/javascript">
function ToggleEnabled(sender, eventArgs)
{
if (sender.get_enabled())
sender.disable();
else
sender.enable();
}
</script>