This is a migrated thread and some comments may be shown as answers.
Urgent Help Required
6 Answers 45 Views
This is a migrated thread and some comments may be shown as answers.
Sher
Top achievements
Rank 2
Sher asked on 11 Mar 2011, 02:16 PM
I am a newbie in using telerik controls so my question may be foolish but i am stuch here so i gotta ask.
i am trying to add appointments into the radscheduler on pageload.....
but i am getting this error
'Telerik.Web.UI.AppointmentCollection' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'Telerik.Web.UI.AppointmentCollection' could be found (are you missing a using directive or an assembly reference?)'
i have referenced Telerik.Web.UI in my page as well as the project....

the code snippet is as below
**dr is the object of SqlDataReader

Appointment ap = new Appointment();
 ap.Subject = dr["Subject"].ToString();
ap.Start = DateTime.Parse(dr["StartDateTime"].ToString());
ap.End = DateTime.Parse(dr[""].ToString());
ap.RecurrenceRule = dr["RecurrenceRule"].ToString();

 this.RadScheduler1.InsertAppointment(ap);   ///Error is on this line...

Thanks in advance

Regards,
Sher


6 Answers, 1 is accepted

Sort by
0
Brian
Top achievements
Rank 1
answered on 11 Mar 2011, 04:00 PM
This is just a guess but you're not assigning a value to the ID property of the appointment - ie ap.ID = dr("ID").ToString().

I think that each appointment needs a subject, start time, end time and ID...

Brian
0
Sher
Top achievements
Rank 2
answered on 11 Mar 2011, 07:32 PM
Thanks for the reply but my problem seems to be with the radScheduler1.Appointments.Add() Function,
as it is used to add the functions to the appointment collection of the scheduler, it is not working, even the intellisense of VS2010 is not giving the suggestion for this function, i am really blank about that :(
0
Accepted
Veronica
Telerik team
answered on 12 Mar 2011, 10:04 AM
Hi Brian,

When inserting appointments to the RadScheduler you need to specify the ID, Start, End and Subject of the appointment:

DateTime start = DateTime.Now.ToUniversalTime();
DateTime end = start.AddHours(1);
Appointment apt = new Appointment("1", start, end, "Do it now.");
RadScheduler1.InsertAppointment(apt);
 
Best wishes,
Veronica Milcheva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Sher
Top achievements
Rank 2
answered on 15 Mar 2011, 06:49 AM
Thanks Veronica, it Works beautifully, but just for the sake of info, can u please tell me why radscheduler1.Appointments.add() is not available to me.


Thanks and Regards,
Sher
0
Veronica
Telerik team
answered on 18 Mar 2011, 09:37 AM
Hi Sher,

The reason why you can not add appointments directly to AppointmentsCollection is that internally it implements the IEnumerable interface. IEnumerable<T> does not necessarily represent a collection to which an items can be added. In fact, it does not necessarily represent a collection at all! It only allows you to iterate the collection but not to modify it.

All the best,
Veronica Milcheva
the Telerik team
0
Sher
Top achievements
Rank 2
answered on 18 Mar 2011, 09:41 AM
Hi Veronica,

Thanks for the reply.

Regards,
Sher
Asked by
Sher
Top achievements
Rank 2
Answers by
Brian
Top achievements
Rank 1
Sher
Top achievements
Rank 2
Veronica
Telerik team
Share this question
or