Skip to main content
A newer version of this page is available. .

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.Mvc.v17.2.dll

Declaration

public delegate object FetchAppointmentsMethod(
    FetchAppointmentsEventArgs args
);

Parameters

Name Type Description
args FetchAppointmentsEventArgs

An FetchAppointmentsEventArgs object that contains the data specific for the ASPxScheduler.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.

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 ASPxScheduler.FetchAppointments method reference.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FetchAppointmentsMethod delegate.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also