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

Grab nth recurrence info

3 Answers 51 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 18 May 2009, 06:14 PM
Is there a function that can be used to grab the info for the nth occurrence of a recurring appointment...I guess, mainly the date/time info.

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar Milushev
Telerik team
answered on 19 May 2009, 11:49 AM
Hi Matt,

You can parse the Appointment's recurrence rule and iterate over the occurrences until you reach the one you need. Sample code follows:

        RecurrenceRule parsedRule = null;
        int n = 4;
        int index = 0;

        if (RecurrenceRule.TryParse(appointment.RecurrenceRule, out parsedRule))
        {
            foreach (DateTime ocurrenceStart in parsedRule.Occurrences)
            {
                if (index == n)
                {
                    // this is the fifth ocurrence
                }

                index++;
            }
        }

Regards,
Dimitar Milushev
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.
0
Matt
Top achievements
Rank 1
answered on 19 May 2009, 03:56 PM
How can I load an appointment variable if I am on a page separate from the radscheduler page?  I saw a findbyid() function in client-side...is there a similar function for server-side?
0
T. Tsonev
Telerik team
answered on 21 May 2009, 11:22 AM
Hi Matt,

You'll need a reference to the RadScheduler in order to obtain information about the loaded appointments. You can use the Appointments.FindByID method in this case.

Alternatively, you can read the appointment data directly from the data source and use the technique from my colleagues reply to evaluate the recurrence rules. You'll then be able to construct a full list of the appointments without having a RadScheduler instance.

All the best,
Tsvetomir Tsonev
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
Matt
Top achievements
Rank 1
Answers by
Dimitar Milushev
Telerik team
Matt
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or