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

RadScheduler Web Service OnClientRequestSuccess

6 Answers 76 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 27 Oct 2010, 07:02 PM
We are using web services binding with the RadScheduler. When a new appointment is added to the scheduler, the service returns a list of appointments in the OnClientRequestSuccess method.  We would like to access the inserted appointment from this list and use it after the service has completed. However, the item is not an SchedulerAppointment object. What is the best way to convert/cast the returned item to a SchedulerAppointment object?

One option we tried was to get the appointment ID from the item and then retrieve the SchedulerAppointment directly from the Scheduler using the findByID method. However, it appears that the scheduler has not been refreshed when the OnClientRequestSuccess method is called, so the appointment is not found. At what point is the scheduler refreshed?

6 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 02 Nov 2010, 09:32 AM
Hi Anthony,

I am not sure what exactly you need to accomplish, but I wonder if you can use the OnClientAppointmentWebServiceInserting event for this case.

Regards,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Peter
Telerik team
answered on 02 Nov 2010, 09:33 AM
Hi Anthony,

I am not sure what exactly you need to accomplish, but I wonder if you can use the OnClientAppointmentWebServiceInserting event for this case.

Regards,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anthony
Top achievements
Rank 1
answered on 12 Nov 2010, 04:07 PM

Hi Peter,

We tried that event, however it didn't accomplish our goal. We want to get access to the newly created appointment object including the new appointment ID right after the appointment has been saved. The other approaches we tried are as follows:

1. We used the Result object in OnClientRequestSuccess to get the returned list of objects and the new item. However, the new item returned fropm was not actually a RadScheduler appointment object. We are not sure how to convert the returned item to a schedulerappointment.

2. We retrieved the ID from the new item object and tried to do a lookup of the item in the RadScheduler. However, at this point, the new item is not actually available in the RadScheduler.

Can you please suggest the best approach for retrieving the new schedulerappointment object with the ID after the WebServices insert event?

Thanks
0
Peter
Telerik team
answered on 17 Nov 2010, 03:20 PM
Hi Anthony,

Please, try the following code and let me know if it was helpful:
function OnClientRequestSuccess(sender, eventArgs)
       {
               var lastAppointmentDataObject =  eventArgs.get_result()[eventArgs.get_result().length-1];
               if(lastAppointmentDataObject != null)
                   alert("Lastly inserted appointment with subject '" + lastAppointmentDataObject.Subject + "' and ID: " + lastAppointmentDataObject.ID);
       }



Peter
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Anthony
Top achievements
Rank 1
answered on 17 Nov 2010, 11:54 PM

Hi Peter,

We did try that already but it only gives us the ID of the appointment. As mentioned, we are trying to get the SchedulerAppointment object, not just the ID. We cannot use the lastAppointmentDataObject because it is not a SchedulerAppointment object. We tried to do a lookup in the Scheduler to get object using the ID, but the appointment is not in the Scheduler at the point where the OnClientRequestSuccess method is called.

Is there a way to create a SchedulerAppointment object from the lastAppointmentDataObject object? If not, at what point is the Scheduler updated with the new appointment so that we can access it?

Thanks

0
Peter
Telerik team
answered on 23 Nov 2010, 12:33 PM
Hello Anthony,

Yes, you can create an appointment object with the client API:

var apt = new Telerik.Web.UI.SchedulerAppointment();
apt.set_subject(lastAppointmentDataObject.Subject);
apt.set_start(startTime);
apt.set_end(endTime);


Kind regards,
Peter
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Scheduler
Asked by
Anthony
Top achievements
Rank 1
Answers by
Peter
Telerik team
Anthony
Top achievements
Rank 1
Share this question
or