Hi Dan,
I am willing to buy DayPilot Pro.
Please let me know if the following feature is there in DayPilot Pro.
The user will click on a time cell. Say 9:30 am. It should open a page in a window. The user will select certain values in the page and click save. The values will be saved in the database and the same values should be shown as a list in the time cell (at 9:30 am). Similarly if a cell has a list of values and if the user clicks on the cell then the list of values have to be passed on to the page opened in the window so that the user can modify the list.
Let me know if this is possible.
This is key for me to use the control.
Thanks
Raghav
Anonymous
-
5/18/2007 4:50:37 PM
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.