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

[Solved] Recurrence on the last day of the month?

3 Answers 134 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Michael Kane
Top achievements
Rank 1
Michael Kane asked on 02 Sep 2009, 08:29 PM
Is it possible to programmatically create a RecurrenceRule such that the event recurs on:

  • Jan 31
  • Feb 28 (or 29)
  • Mar 31
  • April 30

(for example)?

Thank you,

Michael

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 03 Sep 2009, 02:14 PM
Hi Michael,

RadScheduler provides this as a built-in functionality. Please, see the attached screenshot.


Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Michael Kane
Top achievements
Rank 1
answered on 03 Sep 2009, 02:47 PM
Thanks, Peter, but I need to create these events programmatically (without using the Scheduler's UI).

Can you describe how to do that?

Thank you,

Michael
0
Peter
Telerik team
answered on 07 Sep 2009, 03:38 PM
Hello Michael,


You can set the dayOrdinal parameter when using the MonthlyRecurrenceRule constructor. For example:

protected void Page_Load(object sender, EventArgs e)  
    {  
         //Creates a sample appointment that starts at 6/1/2007 3:30 PM (local time) and lasts half an hour.  
                     Appointment recurringAppointment = new Appointment("1", Convert.ToDateTime("6/1/2007 3:30 PM"),  
                         Convert.ToDateTime("6/1/2007 4:00 PM"), "Sample appointment");  
            
                     // Creates a recurrence range, that specifies a limit of 5 occurrences for the appointment.  
                     RecurrenceRange range = new RecurrenceRange();  
                     range.Start = recurringAppointment.Start;  
                     range.EventDuration = recurringAppointment.End - recurringAppointment.Start;  
                     range.MaxOccurrences = 5;  
            
                     // Creates a recurrence rule to repeat the appointment on the last day of every month.  
                     MonthlyRecurrenceRule rrule = new MonthlyRecurrenceRule(-1, RecurrenceDay.EveryDay, 1, range);  
                       
                     Response.Write("Appointment occurrs at the following times: </br> ");  
                     int ix = 0;  
                     foreach (DateTime occurrence in rrule.Occurrences)  
                     {  
                         ix = ix + 1;  
                         Response.Write(occurrence.ToLocalTime()+"</br>");  
                     }  
    } 



Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Scheduler
Asked by
Michael Kane
Top achievements
Rank 1
Answers by
Peter
Telerik team
Michael Kane
Top achievements
Rank 1
Share this question
or