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

Recurring Appointments

4 Answers 184 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 18 Nov 2008, 08:22 PM
Hey,

For recurring appointments, if not using the DataSourceID option, but manually binding, do I have to create each and every appointment?  I'm testing this out by creating a new appointment, but it didn't create the recurring appointment in the scheduler.  How does the recurring appointments supposed to work?

Thanks.

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 19 Nov 2008, 04:31 PM
Hi Brian,

The recurrence string should be in the same format as it is stored in the database with the new lines represented programmatically. Please, see the attached demo which is a modification of this online example. 

For example, please consider the following recurrence string:

"DTSTART:19830104T000000Z
DTEND:19830105T000000Z
RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTHDAY=4;BYDAY=MO,TU,WE,TH,FR,SA,SU;BYMONTH=1
"
Please, note the new lines in the above string. This translates to code-behind as follows:
protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!IsPostBack)  
        {  
            string recurrenceRule = "DTSTART:19830104T000000Z\n\rDTEND:19830105T000000Z\n\rRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTHDAY=4;BYDAY=MO,TU,WE,TH,FR,SA,SU;BYMONTH=1";  
            DateTime start = new DateTime(1983, 1, 4, 0, 0, 0);  
            DateTime end = new DateTime(1983, 1, 5, 0, 0, 0);  
            Appointment a = new Appointment(100, start, end, "John's birthday", recurrenceRule, null, RecurrenceState.Master);  
 
            RadScheduler1.InsertAppointment(a);  
            RadScheduler1.SelectedDate = start;  
                         
        }  
    } 

The new lines from the recurrence string are represented by "\n\r". Perhaps, you missed this part.


Kind regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Brian Mains
Top achievements
Rank 1
answered on 19 Nov 2008, 07:59 PM
Hey,

Thanks for that. My example is creating the reoccurrence from within the UI.  So in the UI, I create a reoccurring appointment.  Now, I'm bound via the DataSource property, and I rebind after I create the appointment.  But after rebinding, it doesn't create all the recurring appointments.

So I create an appointment for today, schedule it to repeat after 10 occurrences one a week from 9AM to 10 AM.  It will create the first one, but not the other 9...  this was all done through the UI.  What I'm asking is this correct and I have to have the responsibility of creating the recurring appointments, or do I manually have to setup the rule?  I'm listening to the AppointmentCreated event, but I don't affect  the UI rendering at all... I simply store the appointment so that I can reload correctly....

I'm binding via DataSource assignment and DataBind() call and do not create programmatic Appointments.

Thanks.
0
Arni
Top achievements
Rank 1
answered on 20 Nov 2008, 04:41 AM
I have done with with user code method Inserting Appointments in RAd sheduler Is working well. even in Reccuring Appointments
protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)  
    {  
        ScheduleEn lomodEn = new ScheduleEn();  
        ScheduleBs lomodBAl = new ScheduleBs();  
        bool recaff = new bool();  
        lomodEn.Subject = Convert.ToString(e.Appointment.Subject);  
        lomodEn.Start = Convert.ToDateTime(e.Appointment.Start.ToString());  
        lomodEn.End = Convert.ToDateTime(e.Appointment.End.ToString());  
        lomodEn.RecurrenceRule = Convert.ToString(e.Appointment.RecurrenceRule);  
        if (e.Appointment.RecurrenceParentID != null)  
        {  
            lomodEn.RecurrenceParentID = Convert.ToString(e.Appointment.RecurrenceParentID.ToString());  
        }  
       recaff = lomodBAl.insert(lomodEn);  
       RadScheduler1.Rebind();  
 
    } 
But Pblm is Radsheduler  my pblm I hv set varchar for RecurrenceParentID. While Editing one of the recuring Apointment
is working.But after editing If I delete tht particular edited appointment in recurring series is giving me error like
"Cannot locate the parent of appointment with ID = '66'. Ensure that the parent appointment with ID = '65' exists and is loaded."
 protected void RadScheduler1_AppointmentDelete(object sender, SchedulerCancelEventArgs e)  
    {  
        if (e.Appointment.Attributes["ReadOnly"] == "true")  
        {  
            e.Cancel = true;  
        }  
        else  
        {  
 
        ScheduleEn lomodEn = new ScheduleEn();  
        ScheduleBs lomodBAl = new ScheduleBs();  
        lomodEn.ID = Convert.ToInt32(e.Appointment.ID.ToString());  
          bool recaff;  
          recaff = lomodBAl.Delete(lomodEn);  
              
             RadScheduler1.Rebind();  
        }  
    } 
Kindly any one help me tosolve this pblm.. Thank you..
0
Peter
Telerik team
answered on 20 Nov 2008, 04:53 PM

Brian, please, make sure you set DataRecurrenceField and DataRecurrenceParentKeyField for RadScheduler. If you alread have this, then the problem is somewhere else with your implementation. In that case, please open a support ticket and send us a small demo which we can test locally.

Arni, you can try changing

lomodEn.RecurrenceParentID = Convert.ToString(e.Appointment.RecurrenceParentID.ToString());

to

lomodEn.RecurrenceParentID = Convert.ToInt32(e.Appointment.RecurrenceParentID.ToString());




Greetings,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Peter
Telerik team
Brian Mains
Top achievements
Rank 1
Arni
Top achievements
Rank 1
Share this question
or