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
15 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.



Comment posted by Anonymous
15 years ago.

Hi Dan,

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

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



Comment posted by Dan Letecky
15 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:'NewEvent.aspx?start=' + start.toUTCString() + '&end=' + end.toUTCString(), 
You can also put it into a separate function:
<script type="text/javascript">
function newEvent(start, end, column) {'NewEvent.aspx?start=' + start.toUTCString() + '&end=' + end.toUTCString(),
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
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
14 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


Comment posted by alankar
14 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
14 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 3 months old and has been closed. Please create a new question if you have anything to add.