Scheduler only shows 21 occurrences

6 posts, 0 answers
  1. Felix
    Felix avatar
    4 posts
    Member since:
    Oct 2012

    Posted 30 Oct 2012 Link to this post

    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
  2. Plamen
    Admin
    Plamen avatar
    2958 posts

    Posted 01 Nov 2012 Link to this post

    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.
  3. Felix
    Felix avatar
    4 posts
    Member since:
    Oct 2012

    Posted 02 Nov 2012 Link to this post

    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.
  4. Felix
    Felix avatar
    4 posts
    Member since:
    Oct 2012

    Posted 02 Nov 2012 Link to this post

    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.
  5. Felix
    Felix avatar
    4 posts
    Member since:
    Oct 2012

    Posted 02 Nov 2012 Link to this post

    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?
  6. Plamen
    Admin
    Plamen avatar
    2958 posts

    Posted 06 Nov 2012 Link to this post

    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.
Back to Top