search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Pass values from time cell and get values back from a page

Asked by Anonymous
17 years ago.

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

Comment posted by Anonymous
17 years ago.

Hi Dan,

I am looking at opening the page from client side javascript using window.open rather than using the DayPilot control events.

Let me know where to get this information in your documentation.

Thanks

Raghav

Comment posted by Dan Letecky
17 years ago.
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.
Comment posted by alankar
16 years ago.

hi.. when i made changes in daypilotcalender.cs of daypilot lite.. i am not able to debug my changes.

please tell me how can i debug my updated code

thanx in advance

Alankar

Comment posted by alankar
16 years ago.
i have to show little demo of outlook like calender to my Client. so please tell me the solution ASAP so that i can buy daypilot pro as per client requirements
Comment posted by Dan Letecky
16 years ago.
In order to debug the control's source code both the control and the web project where you use it should be included as two projects in the same solution.
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.