Events
RadComboBox supports a number of client-side events that let you customize its behavior:
-
OnClientItemsRequestFailed occurs when the load-on-demand callback error appears.
-
OnClientBlur occurs when RadComboBox loses focus.
-
OnClientDropDownOpening occurs before the drop-down list opens.
-
OnClientDropDownOpened occurs after the drop-down list has been opened.
-
OnClientDropDownClosing occurs before the drop-down list closes.
-
OnClientDropDownClosed occurs after the drop-down has been closed.
-
OnClientFocus occurs when RadComboBox has just received input focus.
-
OnClientItemsRequesting occurs when the user triggers the load-on-demand mechanism by typing in the input area or clicking the drop-down toggle of RadComboBoxx. This event fires before the items are added.
-
OnClientItemsRequested occurs immediately after the load-on-demand mechanism has bound new items to RadComboBox.
-
OnClientKeyPressing occurs when a RadComboBox item is selected and the user presses a key.
-
OnClientSelectedIndexChanging occurs before the selected item is changed in response to a user action.
-
OnClientSelectedIndexChanged occurs after the selected item has been changed in response to a user action.
-
OnClientItemChecking occurs when a particular item is about to be checked.
-
OnClientItemChecked occurs after the selected item has been changed in response to a user action.
-
OnClientLoad occurs after the RadComboBox has been fully initialized on the client-side.
-
OnClientTextChange occurs when the text in the input area has been changed.
-
OnClientItemDataBound occurs for each item that is created during Web Service Load on Demand (available after Q3 SP2 2008).
-
OnClientTemplateDataBound occurs after the client template is bound and the binding expression are evaluated.
-
OnClientCheckAllChecking occurs before the check all items check box is checked.
-
OnClientCheckAllChecked occurs after the check all items check box is checked.
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.
<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:
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:
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. |