Telerik UI for ASP.NET AJAX

RadScheduler has a number of properties which value is the name of a JavaScript function that executes when specific client-side events occur. These events are listed below:

Web Service binding specific events:

Reminder related events:

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 RadScheduler property.

CopyASPX
     
<script type="text/javascript">   
  function OnClientAppointmentInserting(sender, eventArgs)
  {
     var now = new Date();
     if (eventArgs.get_startTime() < now)
         eventArgs.set_cancel(true);
  }
</script>

// #region client-side-programming-events_1

function onClickHandler1()
{
 alert("First handler occurs");
}
function onClickHandler2()
{
 alert("Second handler occurs");
}
function pageLoad()
{
 var Scheduler = $find("<%= RadScheduler1.ClientID %>");

 Scheduler.add_timeSlotClick(OnClickHandler1);
 Scheduler.add_timeSlotClick(OnClickHandler2);
}      

// #endregion

// #region client-side-programming-events_2

function removeOnClick2()
{
 var Scheduler = $find("<%= RadScheduler1.ClientID %>");
 Scheduler.remove_timeSlotClick(OnClickHandler2);
}       

// #endregion
</script>
<telerik:RadScheduler  ID="RadScheduler1"  runat="server"    
OnClientAppointmentInserting="OnClientAppointmentInserting"  
DataSourceID = "AppointmentsDS" />

You can also assign event handlers in client-side code. When using the client-side API, pass a reference to the event handler rather than its name. One advantage of using the client-side API is that you can attach multiple event handlers to one event using the standard MS AJAX convention:

CopyJavaScript
function onClickHandler1()
{
 alert("First handler occurs");
}
function onClickHandler2()
{
 alert("Second handler occurs");
}
function pageLoad()
{
 var Scheduler = $find("<%= RadScheduler1.ClientID %>");

 Scheduler.add_timeSlotClick(OnClickHandler1);
 Scheduler.add_timeSlotClick(OnClickHandler2);
}      

Another advantage of the client-side API is that you can detach an event handler dynamically:

CopyJavaScript
function removeOnClick2()
{
 var Scheduler = $find("<%= RadScheduler1.ClientID %>");
 Scheduler.remove_timeSlotClick(OnClickHandler2);
}       

Note that on the client-side, the names of events are slightly different than on the server-side. The following table shows the correspondence between client-side and server-side names:

Server-Side NameClient-Side NameMethods to Add and Remove
OnClientAppointmentClickappointmentClickadd_appointmentClick, remove_appointmentClick
OnClientAppointmentDoubleClickappointmentDoubleClickadd_appointmentDoubleClick, remove_appointmentDoubleClick
OnClientAppointmentDeleteingappointmentDeletingadd_appointmentDeleting, remove_appointmentDeleting
OnClientAppointmentEditingappointmentEditingadd_appointmentEditing, remove_appointmentEditing
OnClientAppointmentInsertingappointmentInsertingadd_appointmentInserting, remove_appointmentInserting
OnClientAppointmentMoveStartappointmentMoveStartadd_appointmentMoveStart, remove_appointmentMoveStart
OnClientAppointmentMovingappointmentMovingadd_appointmentMoving, remove_appointmentMoving
OnClientAppointmentMoveEndappointmentMoveEndadd_appointmentMoveEnd, remove_appointmentMoveEnd
OnClientAppointmentResizeStartappointmentResizeStartadd_appointmentResizeStart, remove_appointmentResizeStart
OnClientAppointmentResizingappointmentResizingadd_appointmentResizing, remove_appointmentResizing
OnClientAppointmentResizeEndappointmentResizeEndadd_appointmentResizeEnd, remove_appointmentResizeEnd
OnClientAppointmentContextMenuappointmentContextMenuadd_appointmentContextMenu, remove_appointmentContextMenu
OnClientTimeSlotClicktimeSlotClickadd_timeSlotClick, remove_timeSlotClick
OnClientTimeSlotContextMenutimeSlotContextMenuadd_timeSlotContextMenu, remove_timeSlotContextMenu
OnClientRecurrenceActionDialogShowingrecurrenceActionDialogShowingadd_recurrenceActionDialogShowing, remove_recurrenceActionDialogShowing
OnClientRecurrenceActionDialogClosedrecurrenceActionDialogClosedadd_recurrenceActionDialogClosed, remove_recurrenceActionDialogClosed
OnClientFormCreatedformCreatedadd_formCreated, remove_formCreated
OnClientAppointmentsPopulatingappointmentsPopulatingadd_appointmentsPopulating, remove_appointmentsPopulating
OnClientAppointmentsPopulatedappointmentsPopulatedadd_appointmentsPopulated, remove_appointmentsPopulated
OnClientAppointmentDataBoundappointmentDataBoundadd_appointmentDataBound, remove_appointmentDataBound
OnClientAppointmentCreatedappointmentCreatedadd_appointmentCreated, remove_appointmentCreated
OnClientResourcesPopulatingresourcesPopulatingadd_resourcesPopulating, remove_resourcesPopulating
OnClientResourcesPopulatedresourcesPopulatedadd_resourcesPopulated, remove_resourcesPopulated
OnClientDataBounddataBoundadd_dataBound, remove_dataBound
OnClientRequestFailedrequestFailedadd_requestFailed, remove_requestFailed
OnClientAppointmentWebServiceInsertingappointmentWebServiceInsertingadd_appointmentWebServiceInserting, remove_appointmentWebServiceInserting
OnClientAppointmentWebServiceDeletingappointmentWebServiceDeletingadd_appointmentWebServiceDeleting, remove_appointmentWebServiceDeleting
OnClientAppointmentWebServiceUpdatingappointmentWebServiceUpdatingadd_appointmentWebServiceUpdating, remove_appointmentWebServiceUpdating
OnClientRecurrenceExceptionCreatingrecurrenceExceptionCreatingadd_recurrenceExceptionCreating, remove_recurrenceExceptionCreating
OnClientRecurrenceExceptionsRemovingrecurrenceExceptionsRemovingadd_recurrenceExceptionsRemoving, remove_recurrenceExceptionsRemoving

See Also

Other Resources