Hi guys.. it seems that the new version of your scheduler has some problems with the deserialization of the types when it postbacks. I will try to describe my scenario and the solution I found (after spending a LOT OF time of investigation).
1.I bind the radscheduler with List<MyClass> and set the datakeyfield = "ID" which is of type LONG.
2.Everything with the binding is OK ...I can see my appointments ;-)
3.I try to EDIT/DELETE/RESIZE some of the existing appointments.
4.Guess what happens ...error : Cannot find the appointment to delete in the Appointments collection.
[ArgumentException: Cannot find the appointment to delete in the Appointments collection.] Telerik.Web.UI.Scheduling.AppointmentController.DeleteAppointment(Appointment appointmentToDelete, Boolean deleteSeries) +1114 Telerik.Web.UI.RadScheduler.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +1062 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
When I examined what's returned back to me after the JSON serialization is a little different from what I expected.The JSON serializer converts the numbers of type long to int.
Then FindByID method of AppointmentCollection class returns null. The reason is in the following statement :
if ((appointment.ID != null) && appointment.ID.Equals(id))
{ return appointment; }
the reason is that during the deserialization the original number (of type long) was converted to type int and the statement "appointment.ID.Equals(id)" always is false => the method returns null.
and then the exception is thrown.
1.I bind the radscheduler with List<MyClass> and set the datakeyfield = "ID" which is of type LONG.
2.Everything with the binding is OK ...I can see my appointments ;-)
3.I try to EDIT/DELETE/RESIZE some of the existing appointments.
4.Guess what happens ...error : Cannot find the appointment to delete in the Appointments collection.
[ArgumentException: Cannot find the appointment to delete in the Appointments collection.] Telerik.Web.UI.Scheduling.AppointmentController.DeleteAppointment(Appointment appointmentToDelete, Boolean deleteSeries) +1114 Telerik.Web.UI.RadScheduler.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +1062 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
When I examined what's returned back to me after the JSON serialization is a little different from what I expected.The JSON serializer converts the numbers of type long to int.
Then FindByID method of AppointmentCollection class returns null. The reason is in the following statement :
if ((appointment.ID != null) && appointment.ID.Equals(id))
{ return appointment; }
the reason is that during the deserialization the original number (of type long) was converted to type int and the statement "appointment.ID.Equals(id)" always is false => the method returns null.
and then the exception is thrown.