scheduler recurrent events

DayPilot Scheduler supports recurring events.

  • Recurrence information is stored is a special VARCHAR database field or it can be mapped manually.
  • Supports daily, weekly, monthly, and yearly recurrence.
  • Sample modal editing dialog included.

Supported rules

Repeat:

Daily (very X days)

recurring events asp.net mvc daily

Weekly (on specified days of week, every X weeks)

recurring events asp.net mvc weekly

Monthly (on specified days of month, every X months)

recurring events asp.net mvc monthly

Annually

recurring events asp.net mvc annually

Number of occurrences:

  • Specify how many times it should be repeated (Times() method)
  • Specify the end date (Until() method)

JavaScript

No built-in support for recurring events. You need to pass the expanded event occurrences in the events list.

ASP.NET WebForms and ASP.NET MVC

Built-In Recurrence Support

The built-in mechanism allows you to store recurrence information in a special database field.

  • Specify the field using DataRecurrenceField. The recurrence rule is stored in a string so it should be a varchar field.
  • Rule exceptions are supported (an individual occurrence can be modified or deleted).
  • The recurring events are expanded automatically.
  • Rules can be encoded and decoded manually using RecurrenceRule class. 

Expanding

The rule is automatically read and expanded during data binding.

  • The master event is always added to the resulting data set. It doesn't have to respect the rule. It is not possible to delete

Creating a new recurring event

Create a rule using RecurrenceRule class and store it in the field specified using DataRecurrenceField.

Daily recurrence, repeat five times

string id = "123";
DateTime start = new DateTime(2013, 1, 1);

string rule = RecurrenceRule.FromDateTime(id, start).Daily().Times(5).Encode();

Weekly recurrence, repeat twice

string id = "124";
DateTime start = new DateTime(2013, 1, 1);

RecurrenceRule.FromDateTime(id, start).Weekly().Times(2).Encode();

Creating an exception from the rule

The occurrence is identified using the master event id and the original start time.

  • You need to create one database record for each rule exception. 
  • Store the encoded exception rule in the DataRecurrenceField.
  • In case of "modified" exception the standard fields stored with the exception (start, end, text) will be used instead of the generated ones.
  • If you want to delete an occurrence that has already been modified you need to 
  • You can find all exception related to a master event by searching the DataRecurrenceField. They all start with a prefix generated using RecurrenceRule.Prefix(masterId).

Create a "modified" exception

string id = "123"; // id of the master event
DateTime start = new DateTime(2013, 1, 2);  // start time of the original occurrence

string rule = RecurrenceRule.EncodeExceptionModified(id, start);

Create a "deleted" exception

string id = "123"; // id of the master event
DateTime start = new DateTime(2013, 1, 3);  // start time of the original occurrence

string rule = RecurrenceRule.EncodeExceptionDeleted(id, start);

Custom Recurrence

You can also use custom recurrence encoding (custom database fields, custom encoding).

Instead of extracting the rule automatically from the database columns specified in DataRecurrenceField you need to set it manually for each event in OnBeforeEventRecurrence method override:

protected override void OnBeforeEventRecurrence(BeforeEventRecurrenceArgs e)
{
  bool everyWeek = e.DataItem["everyweek"];

  if (everyWeek) {
    e.Rule = RecurrenceRule.FromDateTime(e.Value, e.Start).Weekly().Times(10);
  }
}

Tutorials

Demo

ASP.NET WebForms and ASP.NET MVC

Built-In Recurrence Support

The built-in mechanism allows you to store recurrence information in a special database field.

  • Specify the field using DataRecurrenceField. The recurrence rule is stored in a string so it should be a varchar field.
  • Rule exceptions are supported (an individual occurrence can be modified or deleted).
  • The recurring events are expanded automatically.
  • Rules can be encoded and decoded manually using RecurrenceRule class. 

Expanding

The rule is automatically read and expanded during data binding.

  • The master event is always added to the resulting data set. It doesn't have to respect the rule. It is not possible to delete

Creating a new recurring event

Create a rule using RecurrenceRule class and store it in the field specified using DataRecurrenceField.

Daily recurrence, repeat five times

string id = "123";
DateTime start = new DateTime(2013, 1, 1);

string rule = RecurrenceRule.FromDateTime(id, start).Daily().Times(5).Encode();

Weekly recurrence, repeat twice

string id = "124";
DateTime start = new DateTime(2013, 1, 1);

RecurrenceRule.FromDateTime(id, start).Weekly().Times(2).Encode();

Creating an exception from the rule

The occurrence is identified using the master event id and the original start time.

  • You need to create one database record for each rule exception. 
  • Store the encoded exception rule in the DataRecurrenceField.
  • In case of "modified" exception the standard fields stored with the exception (start, end, text) will be used instead of the generated ones.
  • If you want to delete an occurrence that has already been modified you need to 
  • You can find all exception related to a master event by searching the DataRecurrenceField. They all start with a prefix generated using RecurrenceRule.Prefix(masterId).

Create a "modified" exception

string id = "123"; // id of the master event
DateTime start = new DateTime(2013, 1, 2);  // start time of the original occurrence

string rule = RecurrenceRule.EncodeExceptionModified(id, start);

Create a "deleted" exception

string id = "123"; // id of the master event
DateTime start = new DateTime(2013, 1, 3);  // start time of the original occurrence

string rule = RecurrenceRule.EncodeExceptionDeleted(id, start);

Custom Recurrence

You can also use custom recurrence encoding (custom database fields, custom encoding).

Instead of extracting the rule automatically from the database columns specified in DataRecurrenceField you need to set it manually for each event in OnBeforeEventRecurrence method override:

protected override void OnBeforeEventRecurrence(BeforeEventRecurrenceArgs e)
{
  bool everyWeek = e.DataItem["everyweek"];

  if (everyWeek) {
    e.Rule = RecurrenceRule.FromDateTime(e.Value, e.Start).Weekly().Times(10);
  }
}

Tutorials

Demo