DayPilot Knowledge Base

AJAX Calendar/Scheduling Controls
DayPilot Pro (AJAX Calendar Control)
» DayPilot AJAX Calendar
DayPilot Pro (AJAX Monthly Calendar Control)
» DayPilot AJAX Monthly Calendar
DayPilot Pro (AJAX Scheduler Control)
» DayPilot AJAX Scheduler
DayPilot » Knowledge Base » How to use DayPilot Pro for MVC 3 with Razor view engine

How to use DayPilot Pro for MVC 3 with Razor view engine

Last revision: Sep 9, 2011

DayPilot Pro for ASP.NET MVC is compatible with MVC 3 and it supports the Razor view engine.

See also:

Here is an example for DayPilot Calendar:

1. Add a reference to DayPilot.Web.Mvc.dll to the project or add it to the Bin directory of the web application.

2. In order to enable the HTML helpers, add the following DayPilot.Web.Mvc to the namespaces in Views/web.config:

<configuration>
  <system.web.webPages.razor>
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        ...
        <add namespace="DayPilot.Web.Mvc" />
        ...
      </namespaces>
    </pages>
  </system.web.webPages.razor>
</configuration>

3. Now you can use the DayPilot helpers in the Razor views (Index.cshtml).

@using DayPilot.Web.Mvc.Events.Calendar;
@using DayPilot.Web.Mvc.Enums.Calendar;

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>

@Html.DayPilotCalendar("dpc", new DayPilotCalendarConfig
{
    BackendUrl = Url.Content("~/Backend/Calendar"),
    EventResizeHandling = EventResizeHandlingType.CallBack,
    EventMoveHandling = EventMoveHandlingType.CallBack,
    TimeRangeSelectedHandling = TimeRangeSelectedHandlingType.CallBack,
    ViewType = DayPilot.Web.Mvc.Enums.Calendar.ViewType.Week,
    Days = 7,
    StartDate = DayPilot.Web.Mvc.Utils.Week.FirstDayOfWeek(),
    BusinessBeginsHour = 9,
    BusinessEndsHour = 18,
    CssClassPrefix = "calendar_silver_",
    EventArrangement = ArrangementType.Full
})

Related

How to show an event calendar in ASP.NET MVC 3 Razor
Event Calendar for jQuery (ASP.NET MVC)
How to run DayPilot Lite demo with .NET Framework 2.0 [open-source]
How to show a modal dialog in ASP.NET MVC 3 Razor