Skip to main content
A newer version of this page is available. .

ASPxScheduler.InitClientAppointment Event

This event fires for each visible appointment before it is sent to the client for display and enables you to specify client appointment properties.

Namespace: DevExpress.Web.ASPxScheduler

Assembly: DevExpress.Web.ASPxScheduler.v18.2.dll

Declaration

public event InitClientAppointmentHandler InitClientAppointment

Event Data

The InitClientAppointment event's data class is InitClientAppointmentEventArgs. The following properties provide information specific to this event:

Property Description
Appointment Gets the appointment related to the ASPxScheduler.InitClientAppointment event.
Properties Gets the dictionary containing name-value pairs for client appointment properties.

Remarks

Handle this event to specify appointment properties available on the client side. This event fires for each visible appointment before it is sent to the client for display, so you can vary the properties and custom fields. You can also create a specific property to send arbitrary data to the client.

This code snippet illustrates the use of the ASPxScheduler.InitClientAppointment event to transfer appointment property values, custom field content or any string data to the client side. It enables you to use the data in client scripts. With this event, you are no longer hindered by lengthy callbacks used to retrieve the required information from the server.

This event fires for each visible appointment before it is sent to the client for display, so you can vary the properties and custom fields. You can also create a specific property to send arbitrary data to the client side.

To specify the default appointment properties, use the ClientSideAppointmentFieldNames class properties which give you the correct names. For other properties, including custom fields, you are free to specify any name.

The JavaScript code below illustrates how this technique can be used on the client side to show appointment property values to the end-user.

protected void ASPxScheduler1_InitClientAppointment(object sender, InitClientAppointmentEventArgs args) {
    args.Properties.Add(ClientSideAppointmentFieldNames.Description, args.Appointment.Description);
    args.Properties.Add(ClientSideAppointmentFieldNames.Subject, args.Appointment.Subject);
    args.Properties.Add("amount", args.Appointment.CustomFields["Field1"]);
}
    <script type="text/javascript" language="javascript">
        function OnAppointmentClick(s, e) {
            var scheduler = s;
            var apt = scheduler.GetAppointmentById(e.appointmentId);
            lblSubject.SetText("Subject: " + apt.GetSubject());
            lblDescription.SetText("Description: " + apt.GetDescription());
            lblAmount.SetText("Amount: " + apt.amount);
        }
    </script>

Example

The following example illustrates how to use the ASPxScheduler.InitClientAppointment. In this event, custom field values (additional information about appointments) are passed to the client appointments so that these fields values can be analyzed in JS.

protected void ASPxScheduler1_InitClientAppointment(object sender, InitClientAppointmentEventArgs args) {
    args.Properties.Add("cpCompleted", args.Appointment.CustomFields["LessonCompleted"]);
    args.Properties.Add("cpCustomRecurringFlag", args.Appointment.CustomFields["CustomRecurringFlag"]);
    args.Properties.Add("cpCustomRecurringID", args.Appointment.CustomFields["CustomRecurringID"]);
}
See Also