Google and Yahoo Add to Calendar Html Helpers for Asp.net MVC
09 Aug 2010I’ve been working on implementing some iCal functionality for the my gig guide website – Gigpig so users could easily add concert dates to their calendars. This works fine and dandy if you have some desktop program to handle iCal files. I have however been informed that the cool kids roll with Google Calendar (and some strange people with Yahoo?!). I dug around a bit and found you can easily prompt users to add events to these calendars using a link to the calendar with the event details in the query string.
If you want to play around with these parameters I recommend using google’s tools to create a button for google calendar and following the guide on this site for yahoo.
I’ve gone ahead and wrapped them up into some Html helpers for Asp.Net MVC. I didn’t go overboard with the options here so if you will probably want to tweak the code a bit. Calling the helpers is a little wieldy but gets the job done (yahoo is more of the same).
<%= Html.GoogleCalendar("add to google calendar", "a test event!", DateTime.Now, null, "its a test", "testington", "websitename", "www.website.com") %>
Here are some rendered links I prepared earlier: