ASP.NET WebForms

Example 1

Client side (.aspx)

dp.commandCallBack("goto", { date: "2013-07-31" });

Server side (.aspx.cs)

protected void DayPilotCalendar1_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e)
{
  switch (e.Command)
  {
      case "goto":
          DayPilotCalendar1.StartDate = (DateTime) e.Data["date"];
          DayPilotCalendar1.DataSource = loadYourData();
          DayPilotCalendar1.DataBind();
          DayPilotCalendar1.Update();
          break;
  }
}

Example 2

Client side (.aspx)

dp.startDate = "2013-07-31";
dp.commandCallBack("refresh");

Server side (.aspx.cs)

protected void DayPilotCalendar1_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e)
{
  switch (e.Command)
  {
      case "refresh":
          DayPilotCalendar1.DataSource = loadYourData();
          DayPilotCalendar1.DataBind();
          DayPilotCalendar1.Update();
          break;
  }
}

ASP.NET MVC

Example 1

MVC View

dp.commandCallBack("goto", { date: "2013-07-31" });

MVC Controller (Dpc class)

protected override void OnCommand(CommandArgs e)
{
  switch (e.Command)
  {
      case "goto":
          StartDate = (DateTime) e.Data["date"];
          Update(CallBackUpdateType.Full);
          break;

      case "refresh":
          UpdateWithMessage("Refreshed");
          break;

  }
}

protected override void OnFinish()
{
  // only load the data if an update was requested by an Update() call
  if (UpdateType == CallBackUpdateType.None)
  {
      return;
  }

  Events = new EventManager(Controller).Data.AsEnumerable();

  DataStartField = "start";
  DataEndField = "end";
  DataTextField = "text";
  DataIdField = "id";
}

Example 2

Client side (.aspx)

dp.startDate = "2013-07-31";
dp.commandCallBack("refresh");

MVC Controller (Dpc class)

protected override void OnCommand(CommandArgs e)
{
  switch (e.Command)
  {
      case "refresh":
          UpdateWithMessage("Refreshed");
          break;

  }
}

protected override void OnFinish()
{
  // only load the data if an update was requested by an Update() call
  if (UpdateType == CallBackUpdateType.None)
  {
      return;
  }

  Events = new EventManager(Controller).Data.AsEnumerable();

  DataStartField = "start";
  DataEndField = "end";
  DataTextField = "text";
  DataIdField = "id";
}

JavaScript

dp.startDate = "2013-07-31";
// load events
dp.update();