ASPxSchedulerDataWebControlBase.FilterAppointment Event
Enables specific appointments to be hidden in the scheduler.
Namespace: DevExpress.Web.ASPxScheduler
Assembly: DevExpress.Web.ASPxScheduler.v24.1.dll
NuGet Package: DevExpress.Web.Scheduler
Declaration
Event Data
The FilterAppointment event's data class is PersistentObjectCancelEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel | Gets or sets whether to cancel the operation. |
Object | Gets the persistent object (appointment, resource or appointment dependency) for which the event occurs. Inherited from PersistentObjectEventArgs. |
Remarks
You can handle the FilterAppointment event to hide specific appointments in the scheduler. This event fires each time the layout of the ASPxScheduler control is modified (when the control is resized, when the working area is changed by modifying the DayView.ShowAllDayArea or DayView.ShowWorkTimeOnly properties, when new appointments are added, or existing ones are modified, etc.)
The FilterAppointment event is raised in turn for each appointment in the Appointments storage. If the PersistentObjectCancelEventArgs.Cancel parameter is set to true for the currently processed appointment, then this appointment will be hidden in the Scheduler control.
Example
The following example illustrates how to filter appointments based on the “Classes filter” combo box value and the Appointment.Location property value. Call the Refresh method within the ASPxComboBox.SelectedIndexChanged event handler to refresh the scheduler content.
protected void ASPxScheduler1_FilterAppointment(object sender, PersistentObjectCancelEventArgs e) {
if(ASPxComboBoxClassesFilter.Value != null && ASPxComboBoxClassesFilter.Value.ToString() != "(ALL)") {
e.Cancel = (e.Object as Appointment).Location != ASPxComboBoxClassesFilter.Value.ToString();
}
}