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

ObjectDataSource Update Problem

1 Answer 92 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Haroon Khokhar
Top achievements
Rank 1
Haroon Khokhar asked on 13 Jul 2009, 07:11 AM
Hi All,

I having some issues while updating Appointments using ObjectDataSource on Rad Scheduler.

Due to some reason, the appointment start,end time or resource details are not changed on the Scheduler, even though the underlaying database has been updated. Forexample If i move an appointment from one resouce to another, the resource details does not change. Only after I refresh the page, the page displays the accurate details.
I also tried rebinding the Scheduler after calling ObjectDataSource.Update() function under the Scheduler Appointment Update event, so that the system can retrieve the latest data from the database, but nothing happens.

Does anyone know what is causing this problem.

Here is my Appointment_Update event

 protected void rsSchedule_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
        {
          
            // My Custom DTO
            Activity activity = new Activity();
            activity.Id = e.ModifiedAppointment.ID.ToString()
            double duration = e.ModifiedAppointment.Duration.Hours;
            duration = duration + Convert.ToDouble(e.ModifiedAppointment.Duration.Minutes)/60;
            activity.Duration = duration;
            activity.StartDateTime = e.ModifiedAppointment.Start;
            activity.TechId = e.ModifiedAppointment.Resources[0].Key.ToString();

           odsSchedule.UpdateParameters.Clear();
           odsSchedule.UpdateParameters.Add(new Parameter("jobId", TypeCode.Int32, activity.Id));
           odsSchedule.UpdateParameters.Add(new Parameter("duration", TypeCode.Double, activity.Duration.ToString()));
           odsSchedule.UpdateParameters.Add(new Parameter("newDateTime", TypeCode.DateTime, activity.StartDateTime.ToString()));
           odsSchedule.UpdateParameters.Add(new Parameter("techCode", TypeCode.String, activity.TechId));

           odsSchedule.Update();


         }
 
Thanks in advance,
Haroon

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 16 Jul 2009, 07:34 AM
Hi Haroon,

Rebinding RadScheduler after the Update() function should have cured the problem. Did you use Rebind() or DataBind()? The proper method in this case is Rebind().

If the problem persists, please open a support ticket and send us a simple demo project which we can test locally.


Best wishes,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Scheduler
Asked by
Haroon Khokhar
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or