Grab nth recurrence info

4 posts, 1 answers
  1. Matt
    Matt avatar
    66 posts
    Member since:
    Apr 2009

    Posted 18 May 2009 Link to this post

    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.
  2. Answer
    Dimitar Milushev
    Admin
    Dimitar Milushev avatar
    555 posts

    Posted 19 May 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Matt
    Matt avatar
    66 posts
    Member since:
    Apr 2009

    Posted 19 May 2009 Link to this post

    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?
  5. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 21 May 2009 Link to this post

    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.
Back to Top