previous daynext daytoday
RadScheduler allows you to export appointments in the industry-standard iCalendar format. This is achieved via the ExportToICalendar static method of the RadScheduler class. For a step-by-step implementation, please see the Export to ICalendar help topic.
This Code Library example demonstrates how to import iCalendar files using a third-party library.
Notice to Outlook 2003 users: Instead of just opening the file, you need to choose File -> Import and Export -> Import an iCalendar or vCalendar File. Otherwise only the first appointment will be imported.
<%@ Page Language="C#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Scheduler.Export.DefaultCS" CodeFile="DefaultCS.aspx.cs" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %><%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %><%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %><%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %><%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <qsf:HeadTag ID="Headtag1" runat="server" /> <telerik:RadCodeBlock runat="server"> <script type="text/javascript"> function Export(sender, e) { $find("<%= RadAjaxManager1.ClientID %>").__doPostBack(sender.name, ""); } </script> </telerik:RadCodeBlock> <style type="text/css"> .RadScheduler .rsExportButton { position: absolute; bottom: 0; right: 0; border: 0; height: 24px; width: 24px; background: url('Outlook.gif') no-repeat center center; } .RadScheduler .rsAllDayRow .rsExportButton { right: 20px; height: 16px; width: 16px; background: url('smallOutlook.gif'); } </style></head><body class="BODY"> <form id="Form1" method="post" runat="server"> <qsf:Header ID="Header1" runat="server" NavigationLanguage="C#" /> <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadScheduler1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <div style="margin: 5px 0"> <asp:ImageButton runat="server" ID="Button2" ImageUrl="exportButton.gif" AlternateText="Export All to iCalendar" OnClientClick="Export(this, event); return false;" OnClick="Button2_Click" /> </div> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" InitialDelayTime="200" /> <div class="exampleContainer"> <telerik:RadScheduler runat="server" ID="RadScheduler1" Width="750px" TimeZoneOffset="03:00:00" SelectedDate="2012-04-16" DayStartTime="08:00:00" DayEndTime="18:00:00" DataSourceID="AppointmentsDataSource" DataKeyField="ID" DataSubjectField="Subject" DataDescriptionField="Description" DataStartField="Start" DataEndField="End" DataReminderField="Reminder" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID" OnAppointmentCommand="RadScheduler1_AppointmentCommand"> <Reminders Enabled="true" /> <AdvancedForm Modal="true" /> <ResourceTypes> <telerik:ResourceType KeyField="ID" Name="Room" TextField="RoomName" ForeignKeyField="RoomID" DataSourceID="RoomsDataSource" /> <telerik:ResourceType KeyField="ID" Name="User" TextField="UserName" ForeignKeyField="UserID" DataSourceID="UsersDataSource" /> </ResourceTypes> <AppointmentTemplate> <%# Eval("Subject") %> <div style="text-align: right;"> <asp:Button runat="server" ID="Button1" CssClass="rsExportButton" ToolTip="Export to iCalendar" CommandName="Export" OnClientClick="Export(this, event); return false;" Style="cursor: pointer; cursor: hand;" /> </div> </AppointmentTemplate> <TimelineView UserSelectable="false" /> <TimeSlotContextMenuSettings EnableDefault="true" /> <AppointmentContextMenuSettings EnableDefault="true" /> </telerik:RadScheduler> </div> <sds:SessionDataSource ID="AppointmentsDataSource" runat="server" PrimaryKeyFields="ID" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>" SelectCommand="SELECT * FROM [Appointments]" InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [UserID], [RoomID], [RecurrenceRule], [RecurrenceParentID], [Annotations], [Description], [Reminder], [LastModified]) VALUES (@Subject, @Start, @End, @UserID, @RoomID, @RecurrenceRule, @RecurrenceParentID, @Annotations, @Description, @Reminder, @LastModified)" UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [UserID] = @UserID, [RoomID] = @RoomID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Annotations] = @Annotations, [Description] = @Description, [Reminder] = @Reminder, [LastModified] = @LastModified WHERE [ID] = @ID" DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @ID" ClearSessionOnInitialLoad="True" SessionKey="System.Web.UI.Page_AppointmentsDataSource"> <DeleteParameters> <asp:Parameter Name="ID" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="Subject" Type="String" /> <asp:Parameter Name="Start" Type="DateTime" /> <asp:Parameter Name="End" Type="DateTime" /> <asp:Parameter Name="UserID" Type="Int32" /> <asp:Parameter Name="RoomID" Type="Int32" /> <asp:Parameter Name="RecurrenceRule" Type="String" /> <asp:Parameter Name="RecurrenceParentID" Type="Int32" /> <asp:Parameter Name="Annotations" Type="String" /> <asp:Parameter Name="Description" Type="String" /> <asp:Parameter Name="Reminder" Type="String" /> <asp:Parameter Name="LastModified" Type="String" /> <asp:Parameter Name="ID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="Subject" Type="String" /> <asp:Parameter Name="Start" Type="DateTime" /> <asp:Parameter Name="End" Type="DateTime" /> <asp:Parameter Name="UserID" Type="Int32" /> <asp:Parameter Name="RoomID" Type="Int32" /> <asp:Parameter Name="RecurrenceRule" Type="String" /> <asp:Parameter Name="RecurrenceParentID" Type="Int32" /> <asp:Parameter Name="Annotations" Type="String" /> <asp:Parameter Name="Description" Type="String" /> <asp:Parameter Name="Reminder" Type="String" /> <asp:Parameter Name="LastModified" Type="String" /> </InsertParameters> </sds:SessionDataSource> <sds:SessionDataSource ID="RoomsDataSource" runat="server" DisplayWarning="false" ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>" SelectCommand="SELECT * FROM [Rooms]"> </sds:SessionDataSource> <sds:SessionDataSource ID="UsersDataSource" runat="server" DisplayWarning="false" ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>" SelectCommand="SELECT * FROM [Users]"> </sds:SessionDataSource> <qsf:Footer runat="server" ID="Footer1" /> </form></body></html>
Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.
Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.
If you have any questions, do not hesitate to contact us at sales@telerik.com.