[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
   [Expand]Product Information
    Getting Started
   [Expand]Scheduler Elements and Structure
   [Expand]Data Binding
   [Expand]Import and Export
   [Expand]Time Zones
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
   [Expand]Member Tables
   [Expand]Visual Elements
    [Collapse]Data Binding
      How to: Create Appointments with Custom Fields
      How to: Prevent Appointments and Resources from Reloading
      How to: Use the FetchAppointments Event for Faster Appointment Loading
      How to: Filter Appointments
      How to: Filter Resources
      How to: Enable Multi-Resource Appointments
      How to: Bind the Scheduler with Multi-resource Appointments to XPO
    [Expand]Data Exchange
    [Expand]Date and Time
    [Expand]Gantt View
    [Expand]Labels and Statuses
    [Expand]Printing and Reporting
    [Expand]Range Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Use the FetchAppointments Event for Faster Appointment Loading

To speed up processing when there is a large amount of data in the Scheduler Storage, you can use the SchedulerStorageBase.FetchAppointments event. Handle this event to fetch data for the visible time interval only. Before looking at the example, it is recommended that you review the FetchAppointments Event - Handling Large Datasets article.

Create an example that demonstrates the use of the FetchAppointments event by following the steps below.

  1. Create a project with the Scheduler bound to SQL Server data.


    Add a mapping for the Appointment.Id property value using the AppointmentMappingInfo.AppointmentId property. This is required for correct appointment resizing beyond the visible interval when handling the SchedulerStorageBase.FetchAppointments event.

  2. A new parameterized query is required for the FetchAppointment event handler. It will contain From and To parameters, which specify the time interval in which the data will be queried. Note that appointments of the AppointmentType.Pattern type should always be loaded, otherwise all recurring appointments for the series based on this pattern will be lost. To load changed and deleted occurrences, compare the dates contained in the fields mapped with AppointmentMappingInfo.OriginalOccurrenceStart and AppointmentMappingInfo.OriginalOccurrenceEnd mappings instead of Start and End. Enter the following query string in the FillBy Method of the AppointmentsTableAdapter.

    The underlying data source does not contain all appointments in a recurrence series. Only pattern, changed and deleted appointments are stored. When a pattern appointment is loaded into the SchedulerControl, it calculates all appointments in the series and displays them in the View. Thus, the loading of appointment patterns does not result in performance issues in the case of a large data source.

    Double-click the DataSet xsd file to open a data set designer. Right-click the AppointmentsTableAdapter and select Add Query... in the context menu.

    The TableAdapter Query Configuration Wizard is invoked. Enter the query text and click Finish.

  3. We need a way to modify this query at runtime to specify resources. To access the TableAdapter queries, add a new property as shown in the following code snippet:

  4. Add the FetchAppointments handler, as shown in the following code snippet.

    To pad the time interval used to query appointments, we use a range of seven days (PADDING_DAYS constant). You can specify another interval arbitrarily.

  5. Run the project. Navigate the schedule using the DateNavigator control, and observe the changes in the number of rows in the appointment data source.

Expanded See Also

Is this topic helpful?​​​​​​​