search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o


Asked by Frank Sandersen
6 years ago.

How can I do navigation (next and previous month) with the DayPilot Lite MVC month view ?

Answer posted by Dan Letecky [DayPilot]
6 years ago.

You can switch dates using .commandCallBack() method:

MVC View
<div class="note">
    <a href="javascript:dp.commandCallBack('previous');">Previous</a> |
    <a href="javascript:dp.commandCallBack('today');">Today</a> |
    <a href="javascript:dp.commandCallBack('next');">Next</a>

Handle OnCommand event on the server side:

MVC Controller
protected override void OnCommand(CommandArgs e)
  switch (e.Command)
      case "previous":
          StartDate = StartDate.AddMonths(-1);

      case "next":
          StartDate = StartDate.AddMonths(1);

      case "today":
          StartDate = DateTime.Today;

See also the documentation for the Pro version, it works the same way:


Next/Previous Navigation

You need to upgrade to version 1.3.400 (the previous version has a bug in DayPilot.Month.commandCallBack()).


Comment posted by Frank Sandersen
6 years ago.

Thanks a lot! You made my day :) I guess the solution came with version 1.3.400.

Btw, the demo project DayPilotLiteMvc-1.3.400 does not launch in VS 2013. See my screendump.

Comment posted by Dan Letecky [DayPilot]
6 years ago.

There was a bug in 1.3.399 that threw an exception in commadCallBack() in DayPilot.Month.

Thanks for reporting the VS 2013 issue, I will check that.

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.