Skip to main content

FetchAppointmentsMethod Delegate

A delegate method that enables you to dynamically limit the number of appointments loaded into the Scheduler storage.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v23.2.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public delegate object FetchAppointmentsMethod(
    FetchAppointmentsEventArgs args
);

Parameters

Name Type Description
args FetchAppointmentsEventArgs

An FetchAppointmentsEventArgs object that contains the data specific for the ASPxSchedulerDataWebControlBase.FetchAppointments event.

Returns

Type
Object

Remarks

Specify the method that returns an IEnumerable appointment data source as an argument when calling the SchedulerExtension.Bind method override.

View Example: Scheduler - How to implement the FetchAppointment event functionality

@Html.DevExpress().Scheduler(SchedulerSettingsHelper.CommonSchedulerSettings)
   .Bind(Model.FetchAppointments, Model.Resources).GetHtml()
public class SchedulerDataObject {
    public IEnumerable Appointments { get; set; }
    public IEnumerable Resources { get; set; }
    public DevExpress.Web.Mvc.FetchAppointmentsMethod FetchAppointments { get; set; }
}
public class SchedulerDataHelper {
    public static object FetchAppointmentsHelperMethod(FetchAppointmentsEventArgs args) {
        args.ForceReloadAppointments = true;
        SchedulingDataClassesDataContext db = new SchedulingDataClassesDataContext();
        return db.DBAppointments.Where(e => e.StartDate > args.Interval.Start && e.EndDate < args.Interval.End);
    }
}

There is nothing wrong in calling the FetchAppointment delegate multiple times. This happens because of PostData loading and interval changes. Generally, it is dependent on various factors, such as the current view type, the visibility of the Navigation buttons and the presence of the DateNavigator control bound to the Scheduler.

The FetchAppointment technique was primarily introduced in XtraScheduler and ASPxScheduler controls. The Scheduler MVC extension implements the FetchAppointment delegate because its ASP counterpart, the ASPxScheduler, provides the FetchAppointments event.

For more information, review the ASPxSchedulerDataWebControlBase.FetchAppointments method reference.

See Also