You can add, remove, and update events on the client side.

Overview

See also

ASP.NET WebForms

Event adding

Events can be added to the Scheduler using events.add() method.

var e = new DayPilot.Event({
  start:new DayPilot.Date(), 
  end:(new DayPilot.Date()).addHours(5), 
  id: DayPilot.guid(), 
  text: "New Event", resource:'E'
});
dps.events.add(e).notify();

This example will add a new event called "New Event" and notify the server by firing EventAdd event.

protected void DayPilotScheduler1_EventAdd(object sender, EventAddEventArgs e)
{
  // create the event in the database using custom method
  createEvent(e.Event.Value, e.Event.Start, e.Event.End, e.Event.Resource, e.Event.Text);  // your method for updating the database

  // display a message to the user
  DayPilotScheduler1.UpdateWithMessage("Added.");
}

Event updating

Events can be updated using events.update() method. The object representing the event must be acquired using events.find() or event.findRecurrent().

var e = dps.events.find('123');
dps.text('New Event Name');  // update the event text
dps.events.update(e).notify();

This example will find an event with id "123", update the text and displayed HTML, and notify the server by firingEventUpdate event.

protected void DayPilotScheduler1_EventUpdate(object sender, EventUpdateEventArgs e)
{
  createEvent(e.Event.Value, e.Event.Start, e.Event.End, e.Event.Resource, e.Event.Text); // your method for updating the database

  // display a message to the user
  DayPilotScheduler1.UpdateWithMessage("Updated.");
}

Event removing

Events can be removed using events.remove() method. The object representing the event must be acquired usingevents.find() or event.findRecurrent().

var e = dps.events.find('123');
dps.events.remove(e).notify();

This example will find an event with id "123", remove it, and notify the server by firing EventRemove event.

protected void DayPilotScheduler1_EventRemove(object sender, EventRemoveEventArgs e)
{
removeEvent(e.Event.Value); // your method for updating the database

// display a message to the user DayPilotScheduler1.UpdateWithMessage("Deleted."); }

JavaScript

Event adding

Events can be added to the Scheduler using events.add() method.

var e = new DayPilot.Event({
  start:new DayPilot.Date(), 
  end:(new DayPilot.Date()).addHours(5), 
  id: DayPilot.guid(), 
  text: "New Event", resource:'E'
});
dps.events.add(e);

Event updating

Events can be updated using events.update() method. The object representing the event must be acquired using events.find() or event.findRecurrent().

var e = dps.events.find('123');
dps.text('New Event Name');  // update the event text
dps.events.update(e);

Event removing

Events can be removed using events.remove() method. The object representing the event must be acquired usingevents.find() or event.findRecurrent().

var e = dps.events.find('123');
dps.events.remove(e);