Tutorial: ASP.NET MVC 5 Scheduler with Recurring Events

This tutorial shows how to add support for recurring events to the DayPilot ASP.NET MVC 5 Scheduler control. Includes sample Visual Studio 2013 project with C# and VB.NET source code.
Dec 10, 2014
asp.net mvc 5 scheduler recurrence

Features

  • ASP.NET MVC 5
  • Recurrence rules: daily, weekly, monthly, yearly
  • Rule exceptions (an occurrence has a different text, start date, or duration;  occurrence doesn't happen)
  • Stores the recurrence data in a single database field
  • Sample recurrence definition UI (modal dialog with rule options)
  • Allows editing the series or a specific occurrence
  • Visual Studio 2013 Solution
  • C# source code
  • VB.NET source code
  • SQL Server 2014 database (LocalDB)
  • Includes DayPilot Pro for ASP.NET MVC Trial version

Source code of the tutorial is available for download.

Example - Recurring Event Icon

asp.net-mvc-5-recurring-event-icon.png

C#

protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
{
  if (e.Recurrent)
  {
      if (e.RecurrentException)
      {
          e.Areas.Add(new Area().Right(5).Top(5).Visible().CssClass("area_recurring_ex"));
      }
      else
      {
          e.Areas.Add(new Area().Right(5).Top(5).Visible().CssClass("area_recurring"));
      }
  }
}

VB.NET

Protected Overrides Sub OnBeforeEventRender(ByVal e As BeforeEventRenderArgs)
  If e.Recurrent Then
    If e.RecurrentException Then
      e.Areas.Add((New Area()).Right(5).Top(5).Visible().CssClass("area_recurring_ex"))
    Else
      e.Areas.Add((New Area()).Right(5).Top(5).Visible().CssClass("area_recurring"))
    End If
  End If
End Sub

CSS

/* active area */
.area_recurring 
{
  height: 16px;
  width: 16px;
  background: url("repeat16.png");
}

.area_recurring_ex 
{
  height: 16px;
  width: 16px;
  background: url("repeat_exception16.png");
}

DayPilot for JavaScript, ASP.NET WebForms, ASP.NET MVC, Java