DayPilot Lite supports two user actions:
The actions can be handled on the client (by custom JavaScript code) or on the server (by handling the server event).
Property | Description | Type | Default value |
---|---|---|---|
EventClickHandling | Handling of a click on a calendar event. | EventClickHandlingEnum | EventClickHandlingEnum.Disabled |
TimeRangeSelectedHandling | Handling of a click on a free-time slot. | TimeRangeSelectedHandling | TimeRangeSelectedHandling.Disabled |
EventClickJavaScript | JavaScript code that should be executed when the user clicks on a calendar event (provided that EventClickHandling is set to JavaScript). The event object (DayPilot.Event) is available as "e" variable. Set the value of EventClickJavaScript to an empty string to disable the default alert box. | string | "alert('Event id: ' + e.id());" |
TimeRangeSelectedJavaScript | JavaScript code that should be executed when the user clicks on a free-time slot (provided that TimeRangeSelectedHandling is set to JavaScript). The following variables are available: "start", "end" (DayPilot.Date object). Set the value to an empty string to disable the default alert box. | string | "alert('start: ' + start + ', end: ' + end);" |
For more about server-side event handling see Server-side event handling.
The typical action for clicking a free time slot will be creating a new event. You can use the following JavaScript code to redirect the user to a page with new event details:
Set TimeRangeSelectedJavaScript to "document.location='NewEvent.aspx?start=' + start + '&end=' + end;"
In the NewEvent.aspx take the Request.QueryString["start"] value and convert it to DateTime:
DateTime startingTime; if (Request.QueryString["start"] != null) startingTime = Convert.ToDateTime(Request.QueryString["start"]);
Then you can use the value to prefill a form with date and time specification.