Sitefinity Add to Calendar Control for Events Module

Bookmark and Share

Sitefinity CMS recently opened a Marketplace section of their website where community members can contribute various resources such as controls, modules, or themes. Since I've been using Sitefinity a lot lately I thought I'd submit a control that I wrote for one of my latest projects.

Sitefinity has a great built-in Events module that you can use to create and display an events calendar.  It has a lot of features already but I thought it could use a nice "Add to Calendar" feature which would allow you to add a specific event to your Outlook, iCal, or Google Calendar based on the date and location information entered for the event.  The control / handler I've created will do just that. Here's how you can download and setup this feature for your own web site.

Start by downloading the files.

Inside the zip you'll find the following:

A UserControls/AddToCalendar folder. This folder has the user control itself as well as the images and CSS file for it. If you need to adjust the look of the control you can do that by modifying these files. The user control itself also contains the code to create the proper link to Google Calendar. The iCal and Outlook links pass the event GUID to an httpHandler.

An add-to-calendar.ashx file. This is the httpHandler file that will take an event GUID, retrieve the necessary information, and output it into the proper .ICS format. You should upload this file into your web site root folder.

In order for the control to show up on your site, you'll need to add it into the events control template. Sitefinity has built-in templates for all of it's modules but you can override them with your own. The easiest way is to modify the existing event template. You can download a zip file of all these templates from your Sitefinity client account. The file containing the template for the event details page is ~/Sitefinity/ControlTemplates/Events/ContentViewSingleItemView.ascx. Insert the AddToCalendar user control wherever you like in this template just like any standard ASP.NET user control.

Once you've modified the template, you'll need to tell Sitefinity to use it. The easiest way is just to edit the advanced properties of the EventsView control and change the SingleItemTemplatePath property to the control you modified above. See this Knowledge Base article for more on how to map embedded controls to custom templates.

That's it. You now have an elegant way of letting users quickly add your events to their calendars.

No TrackBacks
TrackBack URL: http://www.codescene.com/cgi-bin/mt/mt-tb.cgi/102

Leave a Comment

Free the web - Boycott Internet Explorer 6