The commandCallBack() method can be used to send custom command with custom data to the server side.

Typical Use

  • Reload the event data
  • Switch the visible time range
  • Refresh the control after changing the resources
  • Filtering the visible events

How It Works

When you invoke the commandCallBack() function on the client-side DayPilot Calendar object, it will fire the Command event handler on the server-side using an AJAX call.

In the Command event handler you should call Update() after doing your work and reloading the events using DataBind().

See also: Update() method

Parameters

  • command (string) - custom command type string
  • data (any JavaScript object) - custom data that will be sent to the server-side Command handler

The data parameter will be translated into JsonData class - see also Sending custom data with CallBack.

Reference

ASP.NET WebForms

Example (switching to a specified year)

.aspx

<a href="javascript:dpm.commandCallBack('year', 2013);">Next</a>

.aspx.cs:

protected void DayPilotMonth1_Command(object sender, CommandEventArgs e)
{
  switch (e.Command)
  {
      case "year":
          DayPilotCalendar1.StartDate = new DateTime((int)e.Data, 1, 1);
          break;
      // ...
  }
  // ...
  DayPilotMonth1.DataBind();
  DayPilotMonth1.Update();
}