Occurs before the scheduler starts retrieving the appointments for the specified time interval.
public event FetchAppointmentsEventHandler FetchAppointments
Public Event FetchAppointments As FetchAppointmentsEventHandler
The FetchAppointments event handler receives an argument of the FetchAppointmentsEventArgs type. The following properties provide information specific to this event.
|ForceReloadAppointments||Gets or sets whether the appointments collection should be reloaded after handling the SchedulerStorageBase.FetchAppointments event.|
Gets the time interval which the event was raised for.
(Inherited from TimeIntervalEventArgs)
Handle the FetchAppointments event to manually provide the scheduler storage with appointment data. This can be useful when working with a large amount of data, and only a small part of it needs to be loaded at one time.
The time interval used to select the appointments is specified by the TimeIntervalEventArgs.Interval property.
Do not clear and populate SchedulerStorage.Appointments collection items within the FetchAppointments event handler, because this event was specially created to minimize the loading time in databound mode, by loading only visible appointments. It occurs before the SchedulerStorage starts to retrieve the appointments for the specified time interval, and allows you to modify the data source using the e.Interval property value as a query parameter. If appointments are generated within the FetchAppointments event handler, you may fail to retrieve custom fields when appointments are being displayed, because appointments data is disposed of. That is, it's not suitable for unbound mode.
If the FetchAppointments event is handled, the Scheduler does not rely on its own built-in caching strategy. The FetchAppointments event occurs quite often and in many situations which do not involve any changes in displayed data, such as control resizing. To improve performance, treat these cases as your needs dictate and decide for yourself whether to query the data source for appointment data again or leave the Storage data intact.
The ASPxDateNavigator control, if present on the form and linked with the Scheduler control, could also cause multiple FetchAppointments events to occur. When the DateNavigatorProperties.BoldAppointmentDates is set to true, ASPxDateNavigator requests the appointment information for highlighting the corresponding dates.
See the FetchAppointments Event - Handling Large Datasets document for more information.
The following example illustrates how you can intercept requests for visible interval changes and load only necessary data.
Add a local variable fetchInterval, containing time interval for which the data is obtained from the data source. The query used to fetch the data from the data source has the Start and End parameters, which can be specified to control the amount of fetched data. You can adjust these parameters from within the FetchAppointmens event.
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-enhance-performance-when-handling-a-large-number-of-appointments-e489