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

[Solved] Updating another datasource inside Scheduler Update event

2 Answers 151 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
JK
Top achievements
Rank 1
JK asked on 25 Oct 2007, 10:01 AM
Hi,
I need to update another datasource when the user updates an appointment.  Specifically if the date of appoitnment is moved then the other datasource needs to update another table with that date. 

The error states that the "page.Valid cannot be called before validation has taken place.", this occurs after I have dragged the appointment.  I have illustrated further down on the code where the error occurs.

i have read some forum topics on this and it appears (correct me if I am wrong) the detailsview update, cannot fire until the scheduler has completed its update.  If this is the case how can I get the detailsform to update via code after the scheduler has finished.  I tried putting it in the schedulers databound event but still had teh same problem.

Here is my code to give you an idea of where the error is occuring
  protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)  
    {  
        txAppointmentID.Text = e.Appointment.ID.ToString(); //this control is used as a criteria for a datasource  
        dvServiceHistory.DataBind(); // update results based on criteria from above  
        dvServiceHistory.ChangeMode(DetailsViewMode.Edit); //change the form to accept edit data  
        TextBox TheDate = (TextBox)dvServiceHistory.FindControl("txEditSHDate"); //find the control ready for change  
        string ModifiedDate = e.ModifiedAppointment.Start.ToString(); //obtain new date from appointment  
        TheDate.Text = ModifiedDate.Substring(0, 10).ToString(); //convert to string and strip time from the new appointment date  
        dvServiceHistory.UpdateItem(true); // update record, THIS IS THE LINE WHICH CAUSES THE PAGE.VALID ISSUE, WHERE CAN I PUT THIS LINE?  
    } 

Thanks in Advance

JK

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 25 Oct 2007, 12:22 PM
Hi Jon,

We recommend updating the data source directly, rather than from a detailsview. If there is a reason why you need to do it with detailsview, please, send us a working project and we will try to fix the problem.


Best wishes,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JK
Top achievements
Rank 1
answered on 25 Oct 2007, 12:52 PM
OK,

Worked around it thanks.

JK
Tags
Scheduler
Asked by
JK
Top achievements
Rank 1
Answers by
Peter
Telerik team
JK
Top achievements
Rank 1
Share this question
or