DayPilot for ASP.NET - AJAX Calendar/Scheduling Controls
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

Custom event rendering

There is a special event (BeforeEventRender) that is executed before rendering an event. By handling this event you can modify the calendar event content and properties:

  • Custom color of the bar on the left side (now determined by EventLeftBarColor)
  • Custom background color
  • Custom event HTML (allows custom text formatting, images, etc.)
  • Custom event ToolTip (i.e. title="" XHTML attribute)
  • Disabling specific user actions (moving, clicking, context menu ...)

This will allow the following functionality, useful especially for scheduling and time-tracking applications:

  • Different vertical bar colors for different types of events (for time-tracking applications, e.g. work/break/lunch or $100/$200/$300 per hour)
  • Inserting icons into the events (by event type, for repeating events) 
  • More detailed information about the event (location, description)

Example

CustomEventFormatting.aspx:

<daypilot:daypilotcalendar id="DayPilotCalendar1" runat="server" DataSourceID="XmlDataSource1" 
DataTextField="name" DataValueField="id" StartDate="2007-01-01" DataStartField="Start"
DataEndField="End" OnBeforeEventRender="DayPilotCalendar1_BeforeEventRender" >
</daypilot:daypilotcalendar>

CustomEventFormatting.aspx.cs:

    protected void DayPilotCalendar1_BeforeEventRender(object sender, 
BeforeEventRenderEventArgs e)
    {
        if (e.Value == "2")
        {
            e.DurationBarColor = "red";
            e.BackgroundColor = "lightyellow";
            e.InnerHTML = "<i>WARNING: This is an unusual event.</i><br>" + e.InnerHTML;
        }
    }

In this example we use custom InnerHTML, DurationBarColor, and BackgroundColor when we detect an event with a specific Value (that comes from DataValueField).

Getting the additional data for custom content

The Tag property can keep additional event-specific data. You can specify multiple columns of your data source to be stored with the event (DataTagFields):

DataTagFields="eventtype, eventowner"

In the BeforeEventRender event handler you will access these fields using the Tag property:

  • Tag["eventtype"]
  • Tag["eventowner"]

Server-side event arguments (BeforeEventRenderEventArgs)

It is possible to change the following properties:

Appearance properties:

Behavior properties:

You can also use the following properties when determining the action:

  • Start (event start DateTime)
  • End (event end DateTime)
  • ColumnId (ID of the resource in Resources mode)
  • IsAllDay (true for all-day events)
  • Value (event ID)
  • Tag (custom database fields)

 

Rate DayPilot Pro:

I like:   I don't like:




 




Comments:




 

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.