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

Scheduler only shows 21 occurrences

5 Answers 76 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Felix
Top achievements
Rank 2
Felix asked on 30 Oct 2012, 04:46 PM
I'm getting problems showing appointment with a recursive rule.

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

Sort by
0
Plamen
Telerik team
answered on 01 Nov 2012, 11:58 AM
Hello Felix,

 
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.

Kind regards,
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:
<%@ 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">
 
<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.
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:

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
Plamen
Telerik team
answered on 06 Nov 2012, 10:27 AM
Hi Felix,

 
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.

Greetings,
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.
Tags
Scheduler
Asked by
Felix
Top achievements
Rank 2
Answers by
Plamen
Telerik team
Felix
Top achievements
Rank 2
Share this question
or