Setting Event Handlers via JavaScript
RadCheckBox API exposes client-side methods to attach and detach functions to its event. They can be used as an alternative to the server-side properties for handling events.
To handle the desired event, you can use the respective add_
The next three examples show how to add and remove handlers on the client:
<script type="text/javascript">
function Click(checkbox, args)
{
alert("Checkbox was clicked");
}
function addHandler()
{
var checkBox = $find("<%=RadCheckBox1.ClientID %>");
checkBox.add_clicked(Click);
}
</script>
<script type="text/javascript">
function Click(checkbox, args, arg1)
{
alert("Checkbox was clicked. arg1: " + arg1);
}
function addHandler()
{
var checkBox = $find("<%=RadCheckBox1.ClientID %>");
checkBox.add_clicked(function (checkbox, args) { Click(checkbox, args, "Value1") });
}
</script>
function removeEvents()
{
var checkBox = $find("<%= RadCheckBox1.ClientID %>");
checkBox.remove_click(Click);
}
Name | Description |
---|---|
add_load | The name of the JavaScript function called when the control loads. |
remove_load | Removes a handler for the load event. |
add_clicking | The name of the JavaScript function called when the RadCheckBox control is clicked. |
remove_clicking | Removes a handler for the clicking event. |
add_checkedChanging | The name of the JavaScript function called before the checked state of the checkbox is changed. |
remove_checkedChanging | Removes a handler for the checkedChanging event. |
add_checkedChanged | The name of the JavaScript function called when the checked state of the checkbox is changed. |
remove_checkedChanged | Removes a handler for the checkedChanged event. |
add_clicked | The name of the JavaScript function called when the RadCheckBox control is clicked. |
remove_clicked | Removes a handler for the clicked event. |
add_mouseOver | The name of the JavaScript function called when the mouse hovers over the control. |
remove_mouseOver | Removes a handler for the mouseOver event. |
add_mouseOut | The name of the JavaScript function when the mouse leaves the control. |
remove_mouseOut | Removes a handler for the mouseOut event. |