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

Recurrence Rule Question

1 Answer 87 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
prem
Top achievements
Rank 1
prem asked on 08 Sep 2008, 03:15 PM
Hi,

I'm trying to implement a monthly recurrence rule. What I want is: Starting Sep 9th , every month on 9th the schedule should run from 12 am till 5 pm till Jan 9, 2009. I can't seem to get this to work. Instead of selecting only 9th on the Calendar every month, all days are getting selected between these two days.

Here's the scenario:

Start: Sep 9, 2008 12 am
End:  Jan 9, 2009 5 pm

I'm setting the properties like this:

RecurrenceRange

monthlyRange = new RecurrenceRange();

monthlyRange.Start = Start; // Sep 9, 2008 12 am

monthlyRange.RecursUntil = End;// Jan 9, 2009 5 pm

TimeSpan timeScheduled = Convert.ToDateTime(End.ToShortTimeString()) - Convert.ToDateTime(Start.ToShortTimeString());  //Run from 12 am to 5pm

monthlyRange.EventDuration = timeScheduled.;

MonthlyRecurrenceRule monthlyRecurrenceRule = new MonthlyRecurrenceRule(DayOfMonth, schd.RepeatInterval, monthlyRange); //(9, 1. monthlyRange)

What am I doing wrong?

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 08 Sep 2008, 04:17 PM
Hello,

The event duration actually refers to the duration of the first event. So, if you set it to 5 hours everything should work fine:

monthlyRange.EventDuration = TimeSpan.FromHours(5); 

Let us know if this helps.

All the best,
Tsvetomir Tsonev
the Telerik team

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