Hi,
When copying & pasting an event I'm getting an error saying object expected.
In debug mode it is this line creating the error
v.items = [{'text':'Paste', 'onclick':function() { var e = this.source; var command = this.item.command; if (!copied) { alert('You need to copy an event first.'); return; } commandCallBack('paste', {id:copied, start: e.start});
I think it may be the code in DayPilotScheduler1_Command
Code is
protected void DayPilotScheduler1_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e)
{
switch (e.Command)
{
case "refresh":
DayPilotScheduler1.DataSource = dbGetEvents(DayPilotScheduler1.StartDate, DayPilotScheduler1.Days);
DayPilotScheduler1.DataBind();
DayPilotScheduler1.Update();
break;
case "filter":
LoadResources();
DayPilotScheduler1.DataSource = dbGetEvents(DayPilotScheduler1.StartDate, DayPilotScheduler1.Days);
DayPilotScheduler1.DataBind();
DayPilotScheduler1.Update();
break;
case "navigate":
DateTime start = (DateTime)e.Data["start"];
DateTime end = (DateTime)e.Data["end"];
DayPilotScheduler1.StartDate = start;
// DayPilotScheduler1.DataBind();
DayPilotScheduler1.DataSource = dbGetEvents(DayPilotScheduler1.StartDate, DayPilotScheduler1.Days);
DayPilotScheduler1.DataBind();
DayPilotScheduler1.Update(CallBackUpdateType.Full);
break;
case "paste":
DateTime pasteHere = (DateTime)e.Data["start"];
string id = (string)e.Data["id"];
// find the event using id
// create a new database record using the original event properties
DayPilotScheduler1.DataSource = dbGetEvents(DayPilotScheduler1.StartDate, DayPilotScheduler1.Days); // your method, load events from database
DayPilotScheduler1.DataBind();
DayPilotScheduler1.UpdateWithMessage("Event copied.");
break;
}
DayPilotScheduler1.DataBind();
DayPilotScheduler1.Update(CallBackUpdateType.Full);
Please help
Andy