Overview

License

Licensed for testing and evaluation purposes. Please see the license agreement included in the sample project. You can use the source code of the tutorial if you are a licensed user of DayPilot Pro for JavaScript. Buy a license.

ASP.NET MVC 5 View (Index.cshtml)

@using DayPilot.Web.Mvc
@using DayPilot.Web.Mvc.Data
@using DayPilot.Web.Mvc.Events.Calendar
@{
    ViewBag.Title = "ASP.NET MVC 5 Resource Calendar";
}

<script src="@Url.Content("~/Scripts/DayPilot/daypilot-all.min.js")" type="text/javascript"></script>

@Html.DayPilotCalendar("dp", new DayPilotCalendarConfig
{
    BackendUrl = Url.Action("Backend", "Calendar"),
    ViewType = DayPilot.Web.Mvc.Enums.Calendar.ViewType.Resources,
    Columns =
    {
        new Column("Column A", "A"),
        new Column("Column B", "B"),
    }
})

ASP.NET MVC 5 Controller (CalendarController.cs)

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

namespace TutorialMvc5ResourceCalendar.Controllers
{
    public class CalendarController : Controller
    {
        public ActionResult Backend()
        {
            return new Dpc().CallBack(this);
        }

        class Dpc : DayPilotCalendar
        {

            protected override void OnInit(InitArgs e)
            {
                UpdateWithMessage("Welcome!", CallBackUpdateType.Full);
            }

            protected override void OnFinish()
            {
                if (UpdateType == CallBackUpdateType.None)
                {
                    return;
                }

                /*
                DataIdField = "Id";
                DataStartField = "Start";
                DataEndField = "End";
                DataTextField = "Text";

                Events = from e in dc.Events where !((e.End <= VisibleStart) || (e.Start >= VisibleEnd)) select e;
            */
            }
        }
    }
}