New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

iCalendar Import

*Allowed file extensions:'.ics', size limit: 2MB
  • today
December 2021
December 2021
SMTWTFS
   1234
567891011
12131415161718
19202122232425
262728293031 
       
Dec, 2021
  • Day
  • Week
  • Month
  • Timeline
Sun
Mon
Tue
Wed
Thu
Fri
Sat

Click Snooze to be reminded again in:
Snooze
5 minutes before start

In this demo is shown how data can be imported from an iCalendar file to RadScheduler. RadAsyncUpload is used to upload the file with extension "ics" and pass the information about the appointments to RadScheduler.

In order to achieve this we are using DDay.iCal .Net Library, which offers a rich object model for reading and manipulating iCalendar files and data. Event, To-Do and Journal components which read from the iCalendar file are imported in RadScheduler as AppointmentInfo objects. Events' Recurrence Rules are parsed in a way as if they were created by the interface which RadScheduler offers (in the Advanced Edit Form). To-Dos and Journal entries are imported as 'All Day Events' as most often they do not have End Date or Duration specified.

In the current implementation the import of some appointments with more complex structure of the recurrence exceptions is not supported.

  • DefaultCS.aspx
  • AppointmentInfo.cs
    • AppointmentInfo.cs
    • DefaultCS.aspx.cs
    • RadSchedulerICalendarImporter.cs
  • scripts.js
<%@ Page Language="C#" AutoEventWireup="true" Inherits="Scheduler.Examples.ICalendarImport.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadProgressManager ID="RadprogressManager1" runat="server" />
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">
            /* <![CDATA[ */
            Sys.Application.add_load(function () {
                demo.ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
            });
            /* ]]> */
        </script>
        <script type="text/javascript" src="scripts.js"></script>
    </telerik:RadScriptBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <div class="demo-container">
        <telerik:RadAsyncUpload RenderMode="Lightweight" runat="server" ID="RadAsyncUpload1" OnClientFilesUploaded="OnClientFilesUploaded"
            AllowedFileExtensions=".ics" OnFileUploaded="RadAsyncUpload1_FileUploaded" AutoAddFileInputs="false">
        </telerik:RadAsyncUpload>
        <asp:Label ID="Label2" Text="*Allowed file extensions:'.ics', size limit: 2MB" runat="server" Style="font-size: 10px;"></asp:Label>
        <asp:Label ID="Label1" runat="server" Text="" Style="color: Red;" EnableViewState="false"></asp:Label>
        <telerik:RadScheduler RenderMode="Lightweight" ID="RadScheduler1" runat="server" AllowInsert="false" AllowEdit="false" AllowDelete="false"
            DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataDescriptionField="Description"
            DataEndField="End" DataRecurrenceField="RecurrenceRule" SelectedView="MonthView" DataReminderField="Reminder"
            DataRecurrenceParentKeyField="RecurrenceParentId" EnableDescriptionField="true">
            <Reminders Enabled="true" />
            <AppointmentTemplate>
                <span><%# Eval("Subject") %></span>:
                <span><%# Eval("Description") %></span>
            </AppointmentTemplate>
        </telerik:RadScheduler>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance