Export to Ical using a single button

6 posts, 0 answers
  1. Karl Wilkens
    Karl Wilkens avatar
    206 posts
    Member since:
    Oct 2012

    Posted 08 Mar 2009 Link to this post

    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!
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 09 Mar 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Deepa Balasundaram
    Deepa Balasundaram avatar
    34 posts
    Member since:
    Jul 2009

    Posted 24 Nov 2009 Link to this post

    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));
            }
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 25 Nov 2009 Link to this post

    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.
  6. RSI
    RSI avatar
    83 posts
    Member since:
    Nov 2011

    Posted 02 Jun 2014 in reply to Peter Link to this post

    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!



  7. RSI
    RSI avatar
    83 posts
    Member since:
    Nov 2011

    Posted 04 Jun 2014 in reply to RSI Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017