RadControls for ASP.NET AJAX RadComboBox supports a number of client-side events that let you customize its behavior:
To use these events, simply write a JavaScript function that can be called when the event occurs. Then assign the name of the
JavaScript function as the value of the the corresponding RadComboBox property.
CopyASPX
<script language="javascript" type="text/javascript">
function MyClientBlur(sender, eventArgs) {
alert("blur");
}
</script>
<telerik:radcombobox
id="RadComboBox1"
runat="server"
onclientblur="MyClientBlur">
</telerik:radcombobox>You can also assign event handlers in client-side code:
CopyJavaScript
function MyClientBlur(sender, eventArgs) {
alert("blur");
}
function pageLoad() {
var combo = $find("<%= RadComboBox1.ClientID %>");
combo.add_onClientBlur(MyClientBlur);
}
Another advantage of the client-side API is that you can detach an event handler dynamically:
CopyJavaScript
function RemoveEventHandler() {
var combo = $find("<%= RadComboBox1.ClientID %>");
combo.remove_onClientBlur(MyClientBlur);
}
Note that on the client-side, the names of events are slightly different than on the server side.
The following table shows the correspondance between client-side and server-side names:
Client-SideName | Server-Side Name | Methods to Add and Remove |
|---|
OnClientLoad | load | add_load, remove_load. | |
OnClientKeyPressing | keyPressing | add_keyPressing, remove_keyPressing. | |
OnClientSelectedIndexChanging | selectedIndexChanging | add_selectedIndexChanging, remove_selectedIndexChanging. | |
OnClientSelectedIndexChanged | selectedIndexChanged | add_selectedIndexChanged, remove_selectedIndexChanged. | |
OnClientItemsRequesting | itemsRequesting | add_itemsRequesting, remove_itemsRequesting. | |
OnClientItemsRequested | itemsRequested | add_itemsRequested, remove_itemsRequested. | |
OnClientDropDownOpening | dropDownOpening | add_dropDownOpening, remove_dropDownOpening. | |
OnClientDropDownOpened | dropDownOpened | add_dropDownOpened, remove_dropDownOpened. | |
OnClientDropDownClosing | dropDownClosing | add_dropDownClosing, remove_dropDownClosing. | |
OnClientDropDownClosed | dropDownClosed | add_dropDownClosed, remove_dropDownClosed. | |
OnClientItemsRequestFailed | itemsRequestFailed | add_itemsRequestFailed, remove_itemsRequestFailed. | |
OnClientFocus | onClientFocus | add_onClientFocus, remove_onClientFocus. | |
OnClientBlur | onClientBlur | add_onClientBlur, remove_onClientBlur. | |
OnClientTextChange | textChange | add_textChange, remove_textChange. | |
OnClientItemDataBound | itemDataBound | add_itemDataBound, remove_itemDataBound. | |
For a live example of using client-side events, see
Client Events.
See Also