DayPilot - Open-Source Outlook-Like Calendar/Scheduling Control for ASP.NET
Try the online demo: AJAX-style event creating, moving, resizing, and deleting • Context menu • Day view • Work week view • Week view • Month view • Horizontal/vertical resources view • PostBack/AJAX/JavaScript event handling • Binding to XmlDataSource, SqlDataSource, DataTable, ArrayList • Custom event formatting • UpdatePanel compatibility

6. Handling user actions

There are two types of user actions:

  • clicking a free time (you will typically use this action to create a new event)
  • clicking an event (you will typically use this action to show event details)

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. UserActionHandling UserActionHandling.JavaScript
FreetimeClickHandling Handling of a click on a free-time slot. UserActionHandling UserActionHandling.JavaScript
JavaScriptEventAction JavaScript code that should be executed when the user clicks on a calendar event (provided that EventClickHandling is set to JavaScript). The string "{0}" will be replaced with an event ID. string "alert('{0}');"
JavaScriptFreeAction JavaScript code that should be executed when the user clicks on a free-time slot (provided that FreetimeClickHandling is set to JavaScript). The string "{0}" will be replaced with the date and time specified in the standard format produced by DateTime.ToString("s") - e.g. "2006-05-15T07:00:00". string "alert('{0}');"

For more about server-side event handling see Server-side event handling.

Usage

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 JavaScriptFreeAction to "document.location='NewEvent.aspx?startingtime={0}';"

In the NewEvent.aspx take the Request.QueryString["startingtime"] value and convert it to DateTime:

DateTime startingTime;
if (Request.QueryString["startingtime"] != null)
  startingTime = Convert.ToDateTime(Request.QueryString["startingtime"]);

Then you can use the value to prefill a form with date and time specification.

DayPilot Pro is an advanced DayPilot edition. You can check a thumbnail overview of the most interesting features. There is also an online demo with all the features working (including the AJAX features). If you want to test the design-time support and API you can download a fully functional trial version. And if you like it, you can buy a full version with source code and 12 months of upgrades and support (with a 30-days money back guarantee).

DayPilot Lite is a do-it-yourself open-source edition of DayPilot. Although it misses some DayPilot Pro features, there are thousands of developers using it to build calendar, personal scheduling, and resource booking applications.

Questions or suggestions? Try DayPilot forums or contact us directly.