This is a migrated thread and some comments may be shown as answers.

Export to Ical using a single button

5 Answers 82 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Karl Wilkens
Top achievements
Rank 1
Karl Wilkens asked on 08 Mar 2009, 05:21 PM
Hi,

The examples I have seen have a button-per-appointment approach. I am interested in exporting all appointments via one button click and preferably, that button is a button that is not integrated into the scheduler, but is a simple .net button elsewhere on the page. Has anyone done this/know if it can be done? Thanks!

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 09 Mar 2009, 08:48 AM
Hi Karl,

There is such a button which exports all appointments in the iCalendar Export demo. Please, see the attached screenshot for reference.


Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Deepa Balasundaram
Top achievements
Rank 1
answered on 24 Nov 2009, 10:31 PM
Hello Peter,

I have linkbutton to export the appointments of the RadScheduler. But this is not working. Could you please suggest me some solution?

Thank you,
Deepa

Following is the code I have:

             <asp:Image ID="Image2" runat="server" Height="20px" ImageUrl="~/Images/EmailIcon.JPG"
                Width="25px" />
            <asp:LinkButton ID="lkb_export" runat="server" OnClick="lnk_btn_exportToIcal_Click"
            OnClientClick="Export(this, event); return false;" Font-Bold="True">[Export]</asp:LinkButton>


        protected void lnk_btn_exportToIcal_Click(object sender, EventArgs e)
        {
            TimeSpan currentOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
            //Select all the appointments
            WriteCalendar(RadScheduler.ExportToICalendar(RadScheduler1.Appointments, currentOffset));
        }
0
Peter
Telerik team
answered on 25 Nov 2009, 02:51 PM
Hi Deepa,

To export appointments, you need to do a real postback (not ajax callback). That is why we handle OnClientClick of the button like this:
<script type="text/javascript">
           function Export(sender, e)
           {
               $find("<%= RadAjaxManager1.ClientID %>").__doPostBack(sender.name, "");
           }
       </script>

If you have the above handler too, then I don't see a reason why you would be experiencing problems. The code sample that you sent us looks to be correct. You can try disabling RadAjaxManager(if you use any) with EnableAJAX="false" and let us know if this solves the problem. This will provide us with more clues.


Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
SDI
Top achievements
Rank 1
answered on 02 Jun 2014, 10:31 PM
Mmm, i have tried this demo and can't figure out how you got it to work with the 'Export All' appointments. We dont allow the single appointments in the Scheduler, its all or nothing in our particular application.

We have a button (outside the Schedulker control)
<telerik:RadButton ID="ImageDownloadCalendar" runat="server" OnClick="ImageDownloadCalendar_Click" Width="64px" Height="64px">
<Image ImageUrl="~/images/downloadcalendar.png" />
 </telerik:RadButton>

... this code correctly does the postback and fires off the 'RadScheduler.ExportToICalendar", but nothing happens.

Dim myResponse As HttpResponse = Page.Response
 
            myResponse.Clear()
            myResponse.Buffer = True
 
            myResponse.ContentType = "text/calendar"
            myResponse.ContentEncoding = Encoding.UTF8
            myResponse.Charset = "utf-8"
 
            myResponse.AddHeader("Content-Disposition", "attachment;filename=""EventSchedulerExport.ics""")
 
            myResponse.Write(MyData)
            ' myResponse.[End]()
 
            HttpContext.Current.ApplicationInstance.CompleteRequest()

...we tried with the "myReponse.End" but receive the "Thread was being aborted" error, so we handled it, but nothing happens at all. The download window does not pop up in the browser. We have other downloads which correctly shows the download window. The 'MyData' variable is passed into this routine from the Export button click event and correctly has the appointments in the string.

We don't receive any errors, it just continues as if everything worked (w/o a popup window). Again, we have other downloads that work fine with PDFs and what not, cant understand why this simple routine does not work. We took the code straight from the Demo you mentioned.

Anyone have any suggestions or some insight to getting a seperate button to export all appointments?

Thanks!



0
SDI
Top achievements
Rank 1
answered on 05 Jun 2014, 02:01 AM
grrrrr - forgot to disable ajax for it to work...

function OnRequestStart(sender, args) {
    if (eventArgs.get_eventTarget().indexOf("ImageDownloadCalendar") >= 0)
        eventArgs.set_enableAjax(false);
    document.body.style.cursor = "wait";
}

...all good now
Tags
Scheduler
Asked by
Karl Wilkens
Top achievements
Rank 1
Answers by
Peter
Telerik team
Deepa Balasundaram
Top achievements
Rank 1
SDI
Top achievements
Rank 1
Share this question
or