Hello,
I am following the tutorial for adding an event to the scheduler. I am doing it slightly different however; I am using code behind to call the javascript function that will open the dialog.
Page page = HttpContext.Current.CurrentHandler as Page;
page.ClientScript.RegisterStartupScript(typeof(Page), "Test", "<script type='text/javascript'>timeRangeSelected(" + e.Start + ", " + e.End + ", " + e.Resource + ");</script>");
This calls the javascript function `timeRangeSelected`
function timeRangeSelected(start, end, resource) {
var modal = new DayPilot.Modal();
modal.top = 60; //This is where the modal is positioned.
modal.width = 600;
modal.height = 500;
modal.opacity = 70;
modal.border = "10px solid #d0d0d0";
modal.closed = function () {
//update the scheduler now that the modla has been closed.
dps1.commandCallBack('refresh');
dps1.clearSelection();
};
modal.showUrl("NewEvent.aspx?start=" + start.toStringSortable() + "&end=" + end.toStringSortable() + "&r=" + resource);
}
Inside my Scheduler I have the TimeRangeSelectedHandling to Postback so the code behind will execute. The reason I am using the code behind is because I was to set the date of the my datepickers to the time range selected (the user wont have to input a date or resource).
If I set the TimeRangeSelectedHandling to javascript the dialog will appear and I can add an event (but not set the date or the resource to what the user selected in the time range).
If I have the TimeRangeSelectedHandling set to PostBack I get the following error in the console:
"Uncaught Syntax Error: Unexpected Number"
on this line:
<script type='text/javascript'>timeRangeSelected(4/13/2015 12:00:00 AM, 4/19/2015 12:00:00 AM, 106);</script>
I think maybe has something to do with the format that the date is in? Any help will be greatly appreciated.