That's possible using custom JavaScript code.
1. Opening a new window
You should set TimeRangeSelectedHandling to JavaScript. Then set TimeRangeSelectedJavaScript property to this string:
window.open('NewEvent.aspx?start=' + start.toUTCString() + '&end=' + end.toUTCString(),
'NewEvent','width=400,Height=400,top=200,left=200');
You can also put it into a separate function:
<script type="text/javascript">
function newEvent(start, end, column) {
window.open('NewEvent.aspx?start=' + start.toUTCString() + '&end=' + end.toUTCString(),
'NewEvent','width=400,Height=400,top=200,left=200');
}
</script>
and set TimeRangeSelectedJavaScript to just "newEvent(start, end, column)".
2. Creating a new event from the new window
Hook the click on OK button in the new window (e.g. onclick event of the button) and run the following JavaScript code:
window.opener.DayPilotCalendar1.timeRangeSelectedCallBack(start, end, data);
- DayPilotCalendar1 is the client-side name of the DayPilot control (you can set it using ClientObjectName property)
- start has to be a Date object (you need to extract it from the URL and create the Date object)
- end has to be a Date object (you need to extract it from the URL and create the Date object)
- data has to be a string. You can use it to pass your custom information.
var data = encodeURIComponent(nameInput.value) + '&' +
encodeURIComponent(ownerInput.value) + '&' + encodeURIComponent(typeInput.value);
On the server-side, handle TimeRangeSelected event. You will get TimeRangeSelectedEventArgs as parameter with these properties:
- e.Start (DateTime)
- e.End (DateTime)
- e.Column (string)
Extract your values from e.Column using something like this:
string[] arguments = e.Column.Split('&');
and then decode it:
string name = Server.DecodeUrl(arguments[0]);
string project = Server.DecodeUrl(arguments[1]);
string subProject = Server.DecodeUrl(arguments[2]);
Make changes in the database and call
DayPilotCalendar1.DataBind();
DayPilotCalendar1.Update();
That's all. I'm writing mostly from memory so there can be a typo somewhere. Let me know if there is any problem.
I'll prepare a new demo page with the popup window working and it will be a part of the DayPilot package and the online demo as well.