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

Telerik Scheduler RadSchedulerRecurrenceEditor.RecurrenceRule.MaximumCandidates does not work : Possible bug since 2010

3 Answers 41 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Matt asked on 27 Mar 2017, 09:12 AM

My project still uses Telerik v2011.1.413.35 and came across an issue with the recurrence editor. Here are the settings:

Recurrence: Hourly
Recur every: 1 hr
Repeat end: End By
End by: 10/3/2018

The above setting when configured in UI or preset at Page_Load always generates and stops at only 3000 occurrences. I tried setting/overriding RadSchedulerRecurrenceEditor.RecurrenceRule.MaximumCandidates and RadSchedulerRecurrenceEditor.RecurrenceRule.Range.MaxOccurrences during Page_Load or on click/submit of form, before accessing Occurrences property, as suggested in these forum topics: Link 1, Link 2. That does not work.

So, I went ahead and installed the latest Telerik UI for ASP.NET AJAX, and tried the same experiement a fresh, simple page that only has the recurrence editor, and still does not work. Below is the code snippet, both ASPX and VB page.

01.<%@ Page Language="VB" AutoEventWireup="false" CodeFile="RecurrenceEditor.aspx.vb" Inherits="RecurrenceEditor" %>
03.<!DOCTYPE html>
06.<head runat="server">
07.    <title></title>
08.    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
11.    <form id="form1" runat="server">
12.        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
13.        <asp:Panel ID="pnlRadRecurrenceEditorTest" runat="server" CssClass="ssection" Width="600">
14.            <telerik:RadSchedulerRecurrenceEditor ID="radRecurEditor" runat="server"></telerik:RadSchedulerRecurrenceEditor>
15.            <asp:Button ID="btnRadRecurrenceEditorSubmit" runat="server" Text="Schedule Submit" /><br />
16.            <asp:Label ID="lblRadRecurrenceEditorDetails" runat="server"></asp:Label>
17.        </asp:Panel>
18.    </form>
01.Imports Telerik.Web.UI
03.Partial Class RecurrenceEditor
04.    Inherits System.Web.UI.Page
06.    Protected Sub Page_Load_Recurrence(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
07.        lblRadRecurrenceEditorDetails.Text = String.Empty
08.        If IsPostBack Then Exit Sub
09.        'NOTE: With or without the below code commented, I cannot get occcurrences > 3000 in count
10.        Dim endDate As New Date(2018, 10, 4)
11.        radRecurEditor.StartDate = Now()
12.        radRecurEditor.EndDate = endDate
13.        radRecurEditor.RecurrenceRule = New HourlyRecurrenceRule(1, New RecurrenceRange(Now(), TimeSpan.Zero, endDate, 0))
14.        radRecurEditor.RecurrenceRule.Range.MaxOccurrences = 10002
15.        radRecurEditor.RecurrenceRule.MaximumCandidates = 10001
16.        lblRadRecurrenceEditorDetails.Text += "<br>Max occurrences: " & radRecurEditor.RecurrenceRule.Range.MaxOccurrences.ToString()
17.        lblRadRecurrenceEditorDetails.Text += "<br>Max candidates: " & radRecurEditor.RecurrenceRule.MaximumCandidates.ToString()
18.    End Sub
19.    Protected Sub btnRadRecurrenceEditorSubmit_Click(sender As Object, e As EventArgs) Handles btnRadRecurrenceEditorSubmit.Click
20.        Dim output As New List(Of String)
21.        output.Add("Max candidates: " & radRecurEditor.RecurrenceRule.MaximumCandidates.ToString())
22.        radRecurEditor.RecurrenceRule.MaximumCandidates = 10000 'doesn't work
23.        output.Add("Max candidates changed to: " & radRecurEditor.RecurrenceRule.MaximumCandidates)
24.        output.Add("Max occurrences: " & radRecurEditor.RecurrenceRule.Range.MaxOccurrences.ToString())
25.        output.Add("ToList count: " & radRecurEditor.RecurrenceRule.Occurrences.ToList().Count)
26.        output.Add("Total count: " & radRecurEditor.RecurrenceRule.Occurrences.Count)
27.        output.Add("Last recurring date: " & radRecurEditor.RecurrenceRule.Occurrences.LastOrDefault())
28.        lblRadRecurrenceEditorDetails.Text = String.Join("<br>", output)
29.    End Sub
31.End Class


I have also attached the resultant page view.

Let me know what I'm doing wrong here, or if this is an actual bug in the tool.


3 Answers, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 28 Mar 2017, 05:53 PM

The issue is really really odd. I think this is a bug, but I'm open to explanation of such implementation. Following explains the issue.

If I try to set `MaximumCandidates` by directly referencing the rad schedule recurrence editor, it does not work. BUT, if I assign `RecurrenceRule` property of the editor to a variable, and then set the max property, it works. Following is the code snippet explaining it.

1.radRecurEditor.RecurrenceRule.MaximumCandidates = Integer.MaxValue 'does not work!
2.radRecurrenceRule.MaximumCandidates = Integer.MaxValue 'works!!


Oh well!

Top achievements
Rank 1
answered on 28 Mar 2017, 05:58 PM

Just to clarify, here is the complete code-behind snippet, in reference to the original issue post.

01.Protected Sub Page_Load_Recurrence(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
02.    lblRadRecurrenceEditorDetails.Text = String.Empty
03.    If IsPostBack Then Exit Sub
04.End Sub
05.Protected Sub btnRadRecurrenceEditorSubmit_Click(sender As Object, e As EventArgs) Handles btnRadRecurrenceEditorSubmit.Click
06.    RecurrenceTestOutput(radRecurEditor.RecurrenceRule)
07.End Sub
09.Protected Sub RecurrenceTestOutput(radRecurrenceRule As RecurrenceRule)
10.    Dim output As New List(Of String)
11.    output.Add("Max candidates: " & radRecurrenceRule.MaximumCandidates.ToString())
12.    radRecurEditor.RecurrenceRule.MaximumCandidates = Integer.MaxValue 'does not work!
13.    radRecurrenceRule.MaximumCandidates = Integer.MaxValue 'works!!
14.    output.Add("Max candidates changed to: " & radRecurrenceRule.MaximumCandidates)
15.    output.Add("Max occurrences: " & radRecurrenceRule.Range.MaxOccurrences.ToString())
16.    output.Add("ToList count: " & radRecurrenceRule.Occurrences.ToList().Count)
17.    output.Add("Total count: " & radRecurrenceRule.Occurrences.Count)
18.    output.Add("Last recurring date: " & radRecurrenceRule.Occurrences.LastOrDefault())
19.    lblRadRecurrenceEditorDetails.Text += String.Join("<br>", output)
20.End Sub


Peter Milchev
Telerik team
answered on 30 Mar 2017, 08:45 AM
Hello Matt,

The RecurrenceEditor RecurrenceRule is designed to get only the Recurrence rule text, which does not contain the number of max candidates. That is why the first approach is not changing the MaximumCandidates property. 

In such scenarios, where the recurrence rule needs to be modified, we recommend the approach that you have used in your next reply, assigning the rule to a variable and modify and use the variable.

Peter Milchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question