I have created a Yearly Recurring Event several times and for some reason, the created event doesn't show in the Calendar afterwards. I checked the database and it does seem to get created there. I tried to recreate the issue at least 4 or 5 times, changing some RadScheduler recurring events option. The event seem to be created because I can see it in the database but none of them shows up in the calendar. I was wondering if this is a bug... kindly please advise.
Anyway, I have provided below the steps on how to recreate the issue. I have also provided some of the RecurrencePattern field value.
Thanks so much and appreciate your help.
- Annie
DTSTART:20080901T120000Z DTEND:20080901T130000Z RRULE:FREQ=YEARLY;INTERVAL=1;BYSETPOS=1;BYDAY=MO,TU,WE,TH,FR,SA,SU;BYMONTH=1
DTSTART:20080901T083000^RRULE:FREQ=YEARLY;UNTIL=20100901T190000Z;BYMONTH=9;BYMONTHDAY=1|630
DTSTART:20080901T120000Z DTEND:20080901T130000Z RRULE:FREQ=YEARLY;UNTIL=20090902T000000Z;INTERVAL=1;BYMONTHDAY=1;BYDAY=MO,TU,WE,TH,FR,SA,SU;BYMONTH=1
5 Answers, 1 is accepted
I have tested the scenario, but the appointment shows up just fine. Can you please verify that the appointment is getting read from the database by handling the AppointmentDataBound event? Might be a problem with filtering.
Kind regards,
Tsvetomir Tsonev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I ran the stored procedure used to retrieve the data from the SQL query analyzer itself. I found out that the SP returns the data which includes the Yealy Recurring events. For some reason though, I don't see it displayed in the Calendar. Below is the code:
<telerik:radscheduler id="schCalendar" runat="server" datakeyfield="ID"
datasubjectfield="Title"datastartfield="StartDTm" dataendfield="EndDTm"
datarecurrencefield="RecurrencePattern"
datarecurrenceparentkeyfield="RecurringParentID"
overflowbehavior="Expand" monthvisibleappointmentsperday="3"
onnavigationcomplete="Scheduler_NavigationComplete"
onappointmentinsert="Scheduler_AppointmentInsert"
onappointmentcommand="Scheduler_AppointmentCommand"
onappointmentdelete="Scheduler_AppointmentDelete"
onappointmentupdate="Scheduler_AppointmentUpdate"
onappointmentcreated="Scheduler_AppointmentCreated"
onclientappointmentediting="OnClientAppointmentEditing"
onformcreated="Scheduler_FormCreated"onformcreating="Scheduler_FormCreating"
starteditinginadvancedform="true" startinsertinginadvancedform="true"
enableembeddedskins="false" enableadvancedform="true"
enableresourceediting="true" enablecustomattributeediting="true"
timelineview-userselectable="false"
localization-advancedmoredetails="Invitees"
localization-advanceddescription="Title">
private void LoadScheduler()
{
int calendarViewType = SettingValues.GetAccountSettingAsInt
(NetShareSession.Community.ID, NetShareSession.User.AccountID,
SettingValues.Settings.DefaultCalendarView);
GetWorkDaySettings();
schCalendar.WorkDayStartTime =
new TimeSpan( _WorkdayStartHour,
_WorkdayStartMinute, 0);
if (_WorkdayEndHour == 24)
schCalendar.WorkDayEndTime = new TimeSpan(23, 59, 59);
else
schCalendar.WorkDayEndTime = new TimeSpan(_WorkdayEndHour,
_WorkdayEndMinute, 0);
SetViewType(schCalendar, calendarViewType);
SetSchedulerTemplate(schCalendar, calendarViewType);
schCalendar.CustomAttributeNames =
new string[]
{ "Summary", "Description", "Location", "ContactPhoneNumberID", "IsHoliday",
"IsFeatured", "IsAllDayEvent", "IsRecurringEvent", "CreationHistoryID",
"RefDeleteStatusID", "IsPersonalEvent", "IsCommunityEvent", "IsHouseEvent",
"IsGroupEvent", "IsApproved", "HasGroupResourceRequiringApproval",
"HasCommunityResourceRequiringApproval", "CreatedAccountID",
"GroupID", "HouseID", "GroupName", "CommunityID", "EventType",
"HideOnCalendarGroupList", "Organizer", "ContactPhoneNumber",
"IsSharedCalendarEvent", "ColorCode", "IsReadOnly", "AccountID",
"ShowOnPersonal", "RequireResponseByDTm", "MaxRespondents",
"ResourceID", "Name"
};
BindSchedulerData(
false);
}
private void BindSchedulerData(bool IsRebind)
{
DataTable resourcesDt = new DataTable();
DataTable appointmentsDt = LoadData(null, out resourcesDt);
schCalendar.DataSource = appointmentsDt;
if (IsRebind)
schCalendar.Rebind();
else
schCalendar.DataBind();
}
Thanks for your time and your help. Appreciate it.
Again, everything seems to be correct. Can you please attach a handler to the AppointmentDataBound event to check if it is being called at least for the original appointment? I suspect that the recurrence rule is not getting parsed correctly, but it might be something else.
Best wishes,
Tsvetomir Tsonev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I actually am suspecting too that the recurrence rule is not being parse properly. We have a function to format the recurrence rule if not a Telerik rule. (We have some old data... before we even used the RadScheduler). I stepped through the code and verified that the yearly event I created has a valid Telerik recurrence rule. Having said that, it doesn't go through the "formatting" routine which is correct. However, it doesn't show in the calendar. Below is the code... is there something wrong or something missing?
Also, Hourly, Daily, Weekly, and Monthly recurring events are ok... only the Yearly that is having problems.
Appreciate your help.
Thanks,
Annie
private
DataTable FormatRecurrencePattern(DataTable eventData)
{
foreach (DataRow dr in eventData.Rows)
{
if (dr[EventScheduler.RecurrencePattern] != DBNull.Value && dr
[EventScheduler.RecurrencePattern].ToString() != string.Empty)
{
string recurrencePattern = dr[EventScheduler.RecurrencePattern].ToString();
Telerik.Web.UI.RecurrenceRule ValidRule;
//Only convert the rule if it's an invalid Telerik Rule. (Meaning, it is an Aspose
Recurrence Rule)
if(!Telerik.Web.UI.RecurrenceRule.TryParse(recurrencePattern, out ValidRule))
{
if (recurrencePattern.IndexOf("|") > -1)
recurrencePattern = recurrencePattern.Remove(recurrencePattern.IndexOf
("|"));
recurrencePattern = recurrencePattern.Replace("^", "\r\n");
Aspose.iCalendar.
RecurrencePattern pattern =
new Aspose.iCalendar.RecurrencePattern(recurrencePattern);
//if recurrence rule exists, create Telrik Recurrence Rule
if (pattern.RRules.Count > 0)
{
switch (pattern.RRules[0].Frequency)
{
case Frequency.Hourly:
{
int interval = pattern.RRules[0].Interval;
Telerik.Web.UI.RecurrenceRange range = new RecurrenceRange()
range.Start = pattern.StartDate;
range.RecursUntil = pattern.RRules[0].Until;
HourlyRecurrenceRule hRule = new HourlyRecurrenceRule(interval,
range);
dr[EventScheduler.RecurrencePattern] = hRule.ToString();
break;
}
case Frequency.Daily:
{
int interval = pattern.RRules[0].Interval;
Telerik.Web.UI.RecurrenceRange range = new RecurrenceRange();
range.Start = pattern.StartDate;
range.RecursUntil = pattern.RRules[0].Until;
DailyRecurrenceRule dRule = new DailyRecurrenceRule(interval,
range);
dr[EventScheduler.RecurrencePattern] = dRule.ToString();
break;
}
case Frequency.Weekly:
{
int interval = pattern.RRules[0].Interval;
Telerik.Web.UI.RecurrenceRange range = new RecurrenceRange();
range.Start = pattern.StartDate;
range.RecursUntil = pattern.RRules[0].Until;
Aspose.iCalendar.ByDayCollection dayCol = pattern.RRules[0].ByDay;
RecurrenceDay days = GetTelerikDayMask(dayCol);
WeeklyRecurrenceRule wRule = new WeeklyRecurrenceRule(interval,
days, range);
dr[EventScheduler.RecurrencePattern] = wRule.ToString();
break;
}
case Frequency.Monthly:
{
int interval = pattern.RRules[0].Interval;
Telerik.Web.UI.RecurrenceRange range = new RecurrenceRange();
range.Start = pattern.StartDate;
range.RecursUntil = pattern.RRules[0].Until;
int dayOfMonth = pattern.StartDate.Day;
MonthlyRecurrenceRule mRule = new MonthlyRecurrenceRule
(dayOfMonth, interval, range);
dr[EventScheduler.RecurrencePattern] = mRule.ToString();
break;
}
case Frequency.Yearly:
{
if (pattern.RRules[0].ByMonth.Count > 0)
{
RecurrenceMonth month = GetTelerikMonthMask(pattern.RRules
[0].ByMonth);
int dayOfMonth = pattern.StartDate.Day;
Telerik.Web.UI.RecurrenceRange range = new RecurrenceRange();
range.Start = pattern.StartDate;
range.RecursUntil = pattern.RRules[0].Until;
YearlyRecurrenceRule yRule = new YearlyRecurrenceRule(month,
dayOfMonth, range);
dr[EventScheduler.RecurrencePattern] = yRule.ToString();
}
}
break;
}
}
}
}
}
return eventData;
}
If it is parsed correctly then the problem should be somewhere else. It will be best if we can debug it locally, so we can step through our code. Can you please prepare a small page that demonstrates the issue? Just place a RadScheduler instance and bind it to a stub DataTable with the problematic records from your actual database, so that the problem is visible.
Greetings,
Tsvetomir Tsonev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.