I'm getting problems showing appointment with a recursive rule.
This is the code of the scheduler from the aspx:
And this is the code that I used to insert the appointment:
If I insert the appointment and I check it at runtime the value of "rrule.Occurrences.Count()" it returns 3000 but the scheduler only shows 21. What's the problem? Why the scheduler doesn't show all the occurrences?
Best Regards
This is the code of the scheduler from the aspx:
<
telerik:RadScheduler
ID
=
"scheduler"
runat
=
"server"
SelectedView
=
"MonthView"
DataKeyField
=
"ID"
DataStartField
=
"Start"
DataEndField
=
"End"
DataSubjectField
=
"Subject"
OverflowBehavior
=
"Expand"
>
</
telerik:RadScheduler
>
And this is the code that I used to insert the appointment:
DateTime startAppointment =
new
DateTime(2012, 10, 22, 0, 0, 0);
DateTime endAppointment =
new
DateTime(2012, 10, 22, 10, 0, 0);
TimeSpan startRecurrence =
new
TimeSpan(00, 00, 00);
TimeSpan endRecurrence =
new
TimeSpan(10, 00, 00);
Telerik.Web.UI.Appointment appointment =
new
Telerik.Web.UI.Appointment(
"1"
, startAppointment, endAppointment,
"demo"
);
RecurrenceRange range =
new
RecurrenceRange();
range.Start = startAppointment;
range.EventDuration = endRecurrence - startRecurrence;
range.MaxOccurrences = Int32.MaxValue;
RecurrenceDay dias = RecurrenceDay.EveryDay;
WeeklyRecurrenceRule rrule =
new
WeeklyRecurrenceRule(1, dias, range);
appointment.RecurrenceRule = rrule
.ToString();
scheduler.InsertAppointment(appointment);
If I insert the appointment and I check it at runtime the value of "rrule.Occurrences.Count()" it returns 3000 but the scheduler only shows 21. What's the problem? Why the scheduler doesn't show all the occurrences?
Best Regards
5 Answers, 1 is accepted
0
Hello Felix,
Plamen
the Telerik team
I have tested the scenario described in a sample test web page with RadScheduler bound to an XML provider and but could not observe any unusual behavior. Please review the attached project and let me know if you have further questions.
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Felix
Top achievements
Rank 2
answered on 02 Nov 2012, 08:42 AM
Hi,
your code works fine but I can't see why my version does not. I can't find the difference that makes it fail.
demo.aspx:
demo.aspx.cs:
Thanks a lot.
your code works fine but I can't see why my version does not. I can't find the difference that makes it fail.
demo.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="demo.aspx.cs" Inherits="demoTelerik.demo" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
/>
<
telerik:RadScheduler
ID
=
"RadScheduler1"
runat
=
"server"
SelectedView
=
"MonthView"
DataKeyField
=
"ID"
DataStartField
=
"Start"
DataEndField
=
"End"
DataSubjectField
=
"Subject"
OverflowBehavior
=
"Expand"
>
</
telerik:RadScheduler
>
</
div
>
</
form
>
</
body
>
</
html
>
demo.aspx.cs:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
Telerik.Web.UI;
namespace
demoTelerik
{
public
partial
class
demo : System.Web.UI.Page
{
protected
override
void
OnInit(EventArgs e)
{
base
.OnInit(e);
RadScheduler scheduler = RadScheduler1;
DateTime startAppointment =
new
DateTime(2012, 10, 22, 0, 0, 0);
DateTime endAppointment =
new
DateTime(2012, 10, 22, 10, 0, 0);
TimeSpan startRecurrence =
new
TimeSpan(00, 00, 00);
TimeSpan endRecurrence =
new
TimeSpan(10, 00, 00);
Telerik.Web.UI.Appointment appointment =
new
Telerik.Web.UI.Appointment(
"1"
, startAppointment, endAppointment,
"APP"
);
RecurrenceRange range =
new
RecurrenceRange();
range.Start = startAppointment;
range.EventDuration = endRecurrence - startRecurrence;
range.MaxOccurrences = Int32.MaxValue;
RecurrenceDay dias = RecurrenceDay.EveryDay;
WeeklyRecurrenceRule rrule =
new
WeeklyRecurrenceRule(1, dias, range);
appointment.RecurrenceRule = rrule.ToString();
scheduler.InsertAppointment(appointment);
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
}
}
Thanks a lot.
0

Felix
Top achievements
Rank 2
answered on 02 Nov 2012, 08:47 AM
Hi,
your code works fine but I can't see why my version does not. I can't find the difference that makes it fail.
Thanks a lot.
your code works fine but I can't see why my version does not. I can't find the difference that makes it fail.
Thanks a lot.
0

Felix
Top achievements
Rank 2
answered on 02 Nov 2012, 12:45 PM
I saw that if I change your OnInit function to this:
When I click the button, the appointment created manually doesn't create all the occurrences. Why?
protected
override
void
OnInit(EventArgs e)
{
base
.OnInit(e);
//RadScheduler1.Provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/Appointments.xml"), true);
}
When I click the button, the appointment created manually doesn't create all the occurrences. Why?
0
Hi Felix,
Plamen
the Telerik team
You just have to bind RadScheduler to some data source so that it can be working properly and inserting and displaying correctly all the appointments.
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.