Unable to use ExportToICalendar

4 posts, 1 answers
  1. Arsalan
    Arsalan avatar
    3 posts
    Member since:
    Dec 2011

    Posted 21 Dec 2011 Link to this post

    Here is the code...

    protected void btnOutlookExport_Click(object sender, EventArgs e)
    {
       WriteCalendar(rsReservations.ExportToICalendar(rsReservations.Appointments));
    }

    and this is the error I am getting:

    Compiler Error Message: CS0176: Member 'Telerik.Web.UI.RadScheduler.ExportToICalendar(Telerik.Web.UI.AppointmentCollection)' cannot be accessed with an instance reference; qualify it with a type name instead

    What am i missing? How should I be accessing the appointments?

    Visual Studio underlines ExportToICalendar in red and says...
    C#: Cannot access a static method on an instance

    The demos show this method being used and it works on the demos. Is there something I am missing?

    Thanks in advance for your time and help.
  2. Answer
    Peter
    Admin
    Peter avatar
    6637 posts

    Posted 22 Dec 2011 Link to this post

    Hello,

    ExportToICalendar is a static method and it is called directly from the RadScheduler class like this -

    RadScheduler.ExportToICalendar(...)


    Kind regards,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. Arsalan
    Arsalan avatar
    3 posts
    Member since:
    Dec 2011

    Posted 22 Dec 2011 Link to this post

    rsReservations IS my RadScheduler object from the aspx page.

    Here is the WriteCalendar function from my copied. I copied these exactly from the demo online. Do I need anything else except the usings?

    protected void btnOutlookExport_Click(object sender, EventArgs e)
        {
            WriteCalendar(rsReservations.ExportToICalendar(rsReservations.Appointments));
        }
        private void WriteCalendar(string data)
        {
            HttpResponse response = Page.Response;
     
            response.Clear();
            response.Buffer = true;
     
            response.ContentType = "text/calendar";
            response.ContentEncoding = Encoding.UTF8;
            response.Charset = "utf-8";
     
            response.AddHeader("Content-Disposition", "attachment;filename=\"RadSchedulerExport.ics\"");
     
            response.Write(data);
            response.End();
        }

  4. Arsalan
    Arsalan avatar
    3 posts
    Member since:
    Dec 2011

    Posted 23 Dec 2011 Link to this post

    Sorry, i just now figured out what i was doing wrong and what you were trying to explain to me.
Back to Top