To handle a client-side event, create a JavaScript event handler function and assign its name to the respective script property of the Calendar class. The properties that contain the names of the JavaScript event handlers have the same name as the event with a Script suffix added, in the form of [EventName]Script. The signature of the handler must contain the sender and args parameters, where sender is always the Calendar and args are the event arguments associated with the event. For example, add a "function onItemDoubleClick(sender, args)" script to handle the ItemDoubleClick event.
Almost every element in the Calendar has certain events which can trigger JavaScript functions. For example, when a Item is created by a user action, the ItemCreated event will be raised invoking the function whose name is specified in the ItemCreatedScript property. For each client-side event, there is a string property of the form [EventName]Script that specifies the respective JavaScript event handler function that should be called. In the Visual Studio Properties window, type in the name of the event handler function in the field of the respective event property, for example [EventName]Script = "onEventName".
Most events are raised to notify you that the user has performed some action. A modification event is raised to let your application know about the modified item (for example ItemModified). When a user presses the DEL key, an item-deleted event is raised (for example ItemDeleted). The events ItemClicked, ItemDoubleClicked, DateClicked occur when an item or other element is clicked. There are many other events related to various activities a user could carry out in the Calendar.
Validation events let you approve or reject users actions. The event handler functions are expected to set the value of the Sys.CancelEventArgs cancel property accessible through the args parameter of the handler, either set_cancel(false) if an action should be accepted, or set_cancel(true) if it should be rejected.
While the user is holding down the mouse button and dragging an item, a modification validation event is raised continuously (for example ItemModifying). There are events raised when users creates items, for example ItemCreating. When the user presses the Delete key, the ItemDeleting or RecurringItemDeleting events are raised to let you confirm the operation.
The following events occur when the mouse pointer enters or leaves an Item: ItemMouseEnter or ItemMouseLeave. Respectively, the following event is raised when the mouse pointer moves over an Item: ItemMouseMove.
The following table presents all client side events with their associated event arguments, the respective Calendar Script property and a short description:
Event | Event arguments | Script property | Description |
---|---|---|---|
CalendarLoad | null | Raised just after the calendar has finished loading and is ready for interaction. | |
MouseMove | Raised when the user moves the mouse over the Calendar area. | ||
MouseEnter | Raised when the user enters the area over the Calendar with the mouse. | ||
MouseLeave | Raised when the user leaves the area over the Calendar with the mouse. | ||
Click | Raised when the user clicks anywhere on the Calendar with the mouse. | ||
DoubleClick | Raised when the user double-clicks anywhere on the Calendar with the mouse. | ||
MonthHeaderClick | Raised when the user clicks with the mouse on the main header of the Single Month view of the Calendar. | ||
TimetableColumnHeaderClick | Raised when the user clicks with the mouse on the column header of the timetable view of the Calendar. | ||
WeekRangeHeaderClick | Raised when the user clicks with the mouse on the main header of the Week Range view of the Calendar. | ||
ListViewHeaderClick | Raised when the user clicks with the mouse on the main header of the list view of the Calendar. | ||
MonthRangeHeaderClick | Raised when the user clicks with the mouse on the main header of the Month Range view of the Calendar. | ||
SelectionStart | Raised when cell selection starts. | ||
SelectionEnd | Raised when cell selection ends. | ||
SelectionChanged | Raised when cell selection has changed. | ||
ItemSelectionChanged | Raised when item selection has changed. | ||
DateClick | Raised when the user clicks a time cell in a calendar view. | ||
DateHeaderClick | Raised when the user clicks the header of a time cell in a calendar view. | ||
DateDoubleClick | Raised when the user double-clicks a time cell in a calendar view. | ||
DateMouseDown | Raised when the user presses a mouse button down over a time cell in a calendar view. | ||
DateMouseUp | Raised when the user releases a mouse button oven a time cell in a calendar view. | ||
ItemClick | Raised when the user clicks an Item. | ||
ItemDoubleClick | Raised when the user double-clicks an Item. | ||
ItemMouseDown | Raised when the user presses a mouse button down over an Item. | ||
ItemMouseUp | Raised when the user releases a mouse button over an Item. | ||
ItemMouseEnter | Raised when the user enters the area over an Item with the mouse. | ||
ItemMouseLeave | Raised when the user leaves the area over an Item with the mouse. | ||
ItemMouseMove | Raised when the user moves the mouse in the area over an Item. | ||
ItemDragStart | Raised when the user starts to drag an Item with the mouse. | ||
ItemDragEnd | Raised when the user finishes to drag an Item with the mouse. | ||
ItemInplaceEditStarting | Raised just before the user starts an inplace edit operation on an Item. | ||
ItemInplaceEditEnding | Raised just before the user commits an inplace edit operation on an Item. | ||
ItemReminderTriggered | Raised when a Reminder associated with an Item is triggered. | ||
ItemCreating | Raised just before an Item is created. | ||
ItemCreated | Raised when an Item is created. | ||
ItemModifying | Raised when an Item is being modified. | ||
ItemModified | Raised when an Item is modified. | ||
ItemDeleting | Raised just before an Item is deleted. | ||
RecurringItemDeleting | Raised just before a recurring Item is deleted. | ||
ItemDeleted | Raised when an Item is deleted. | ||
MoreItemsCueMouseDown | Raised when the user presses a mouse button over a more items cue. | ||
MoreItemsCueMouseUp | Raised when the user releases a mouse button over a more items cue. | ||
FormShow | Raised just before a popup form is shown. | ||
TaskReminderTriggered |
Handle the ItemModifying event to perform validation:
ASPX
![]() |
---|
<!-- Assign the name of the JavaScript function that will handle the ItemModifying event. --> |
C#
![]() |
---|
// Assign the name of the JavaScript function that will handle the ItemModifying event. |
Visual Basic
![]() |
---|
' Assign the name of the JavaScript function that will handle the ItemModifying event. |
JavaScript
![]() |
---|
<script type="text/javascript"> |
Handle the Load event to perform coloring of the title text of time cells, that contain items:
ASPX
![]() |
---|
<!-- Assign the name of the JavaScript function that will handle the Load event. --> |
C#
![]() |
---|
// Assign the name of the JavaScript function that will handle the Load event. |
Visual Basic
![]() |
---|
' Assign the name of the JavaScript function that will handle the Load event. |
JavaScript
![]() |
---|
<script type="text/javascript"> |