I am using Telerik RadScheduler with Web Service binding.
When I drag an appointment to another timeslot, I do some client-side validation in OnClientAppointmentMoveEnd
, and if that succeeds I set args.set_cancel(true);
It then hits my web service method UpdateAppointment
.
My server side code within this web service call then does some additional validation based on a database query.
My question is - if this server side validation fails, how can I get the client-side appointment to move back to where it originated? I can catch a status or message in OnClientRequestFailed
but is there a way to cancel the move event after the web service call, or move the appointment back?
I just found my own answer - After the
UpdateAppointment
web method is called, the scheduler will then callGetAppointments
again, so the correct data should be reloaded on the client.For others who might find this useful:
MySchedulerResult
inheriting fromSchedulerOperationResult<AppointmentData>
, with anErrorMessage
property.UpdateAppointment
Web Method returns this MySchedulerResult and assigns the Appointments returned fromProvider.UpdateAppointment
to it. It checks the Session to see if a validation error occurred, and sets theErrorMessage
property to this value if found.OnClientRequestSuccess
method on the client side unpacks this result and pops up the error message if found. Meanwhile the appointment data is getting reloaded and should have the changed appointment back in its original timeslot.I found more info around the scheduler result class here: http://docs.telerik.com/devtools/aspnet-ajax/controls/scheduler/web-service-binding/returning-extra-data-from-the-web-service