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

Unable to use ExportToICalendar

3 Answers 69 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Arsalan
Top achievements
Rank 1
Arsalan asked on 22 Dec 2011, 12:22 AM
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.

3 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 22 Dec 2011, 09:38 AM
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
0
Arsalan
Top achievements
Rank 1
answered on 22 Dec 2011, 09:44 PM
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();
    }

0
Arsalan
Top achievements
Rank 1
answered on 23 Dec 2011, 09:34 AM
Sorry, i just now figured out what i was doing wrong and what you were trying to explain to me.
Tags
Scheduler
Asked by
Arsalan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Arsalan
Top achievements
Rank 1
Share this question
or