DayPilotNavigator can switch the date of any main DayPilot control.

1. Set BoundDayPilotID

Assign the ID of the DayPilotCalendar to DayPilotNavigator.BoundDayPilotID property.

Supported target controls:

2. Update the StartDate in Command event handler

Create a new event handler for the DayPilotCalendar.Command event and watch for e.Command == "navigate". The selected start/end range are stored in e.Data:

C#

    protected void DayPilotCalendar1_Command(object sender, CommandEventArgs e)
    {
        switch (e.Command)
        {
            case "navigate":
                DateTime start = (DateTime) e.Data["start"];
                DateTime end = (DateTime) e.Data["end"];

                DayPilotCalendar1.StartDate = start;
                DayPilotCalendar1.DataBind();
                DayPilotCalendar1.Update();
                break;
        }
    }

VB.NET

    Protected Sub DayPilotCalendar1_Command(ByVal sender As Object, ByVal e As DayPilot.Web.Ui.Events.CommandEventArgs) Handles DayPilotCalendar1.Command
        Select Case e.Command
            Case "navigate"
                Dim start As DateTime = e.Data("start")
                DayPilotCalendar1.StartDate = start
                DayPilotCalendar1.DataBind()
                DayPilotCalendar1.Update()
                Exit Select
        End Select
    End Sub

3. How it works

The navigator will call commandCallBack() on the target control (BoundDayPilotID property) whenever the selected date is changed.

The command argument of the commandCallBack() will be set to the value of DayPilotNavigator.BindCommand property (the default value is "navigate"). Normally it's not necessary to change this property.

The details about the selection will be passed in data argument ("start" and "end" properties).

See also