aspnet-3845-components-scheduler-examples-data-binding-how-to-filter-appointments.md
The following example demonstrates how to filter appointments displayed within a scheduler according to a condition. The ASPxSchedulerDataWebControlBase.FilterAppointment event is intended specifically for this purpose. The code below demonstrates how to hide all tentative appointments (those whose status is set to AppointmentStatusType.Tentative).
using DevExpress.XtraScheduler;
using DevExpress.Web.ASPxScheduler;
// ...
protected void ASPxScheduler1_FilterAppointment(object sender, PersistentObjectCancelEventArgs e) {
// Filter all tentative appointments.
object statusKey = ASPxScheduler1.Storage.Appointments.Statuses.GetByType(
AppointmentStatusType.Tentative);
e.Cancel = ((Appointment)e.Object).StatusKey == statusKey;
}
Imports DevExpress.XtraScheduler
Imports DevExpress.Web.ASPxScheduler
' ...
Protected Sub ASPxScheduler1_FilterAppointment(ByVal sender As Object, ByVal e As _
PersistentObjectCancelEventArgs) Handles ASPxScheduler1.FilterAppointment
' Filter all tentative appointments.
Dim statusKey As Object = ASPxScheduler1.Storage.Appointments.Statuses.GetByType(AppointmentStatusType.Tentative)
e.Cancel = (CType(e.Object, Appointment)).StatusKey = statusKey
End Sub