The requested page is not available for the requested platform. You are viewing the content for Default platform.

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.v19.2.dll

Declaration

public delegate object FetchAppointmentsMethod(
    FetchAppointmentsEventArgs args
);
Public Delegate Function FetchAppointmentsMethod(
    args As FetchAppointmentsEventArgs
) As Object

Parameters

Name Type Description
args FetchAppointmentsEventArgs

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

Returns

Type Description
Object

Remarks

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

public class SchedulerDataObject
{
    public IEnumerable Appointments { get; set; }
    public IEnumerable Resources { get; set; }
    public DevExpress.Web.Mvc.FetchAppointmentsMethod FetchAppointments { get; set; }
}
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);
}

@Html.DevExpress().Scheduler(SchedulerSettingsHelper.CommonSchedulerSettings)
   .Bind(Model.FetchAppointments, Model.Resources).GetHtml()

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