New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
OnItemClicking
The itemClicking
event occurs when item in RadCheckBoxList is clicked, immediately after the mouse button is released. The event is fired after the client-side validation, and can be canceled.
The event handler receives two parameters:
-
The instance of the loaded RadCheckBoxList control.
-
An eventArgs parameter of type Telerik.Web.UI.ButtonListCancelEventArgs, containing the following properties and methods:
- get_item() - returns an instance of type Telerik.Web.UI.ButtonListItem (the clicked item).
- get_cancel() - sets a bool value that indicates whether the event will be canceled. Setting true means the event will be canceled.
- set_cancel() - returns a bool value that indicates whether the event was canceled. True means the event is canceled.
Example 1: Handling RadCheckBoxList OnItemClicking event.
ASP.NET
<script type="text/javascript">
function OnItemClicking(sender, args) {
var selectedLanguage = args.get_item().get_text();
var toChange = !confirm("You clicked on " + selectedLanguage + " language!");
args.set_cancel(toChange);
}
</script>
<telerik:RadCheckBoxList runat="server" ID="RadCheckBoxList1">
<ClientEvents OnItemClicking="OnItemClicking" />
<Items>
<telerik:ButtonListItem Text="English" Selected="true" />
<telerik:ButtonListItem Text="German" />
<telerik:ButtonListItem Text="French" />
</Items>
</telerik:RadCheckBoxList>