2X faster development
The ultimate ASP.NET MVC UI toolkit to boost your development speed.
This knowledge base article explains the way to parse the recurrence rule at server side by making use of a new generic utility class RecurrenceHelper.
By referring to the RecurrenceHelper class in your sample project, you can make use of the GetRecurrenceDateTimeCollection method which automatically generates the date instances as a result. Below 4 type parameters can be passed to GetRecurrenceDateTimeCollection method.
Type 1: Recurrence rule and start date value (Mandatory parameters). In this type, we need to pass two mandatory arguments such as recurrence rule and recurrence start date.
Type 2: Maximum number of occurrences to retrieve. In this type, we can pass the maximum occurrences count (ex: 60) to be retrieved when “Ends Never” option is present in the recurrence. By default, the Ends never maximum count is processed as 43.
Type 3: RecurrenceException. In this type, we can pass the RecurrenceException date (ex: "20180610T040000Z") for excluding the dates along with mandatory arguments.
Type 4: Maximum number of occurrences to retrieve and RecurrenceException.
In this type, we can pass the RecurrenceException for excluding the dates (ex: "20180610T040000Z") and the maximum occurrence count (ex: 60) for the “Ends Never” option, with the mandatory arguments.
The following steps explains the way to parse the Recurrence Editor control’s recurrence rule using RecurrenceHelper utility class.
Step 1: Create an MVC application with Recurrence Editor by referring the following user guide link. Also, define the Change client-side event as shown in the following code example.
Step 2: Within the Recurrence Editor Change event, the selected recurrence rule is sent to the getDates controller function as shown in the following code example.
Step 3: In getDates controller function recurrence rule is parsed using GetRecurrenceDateTimeCollection method and date collections are returned as shown in the following code example.
Step 4: Run the sample, initially Recurrence Editor is displayed as shown in the following image.
Figure 1: Default Recurrence Editor.
When the rule is changed to Daily, corresponding date collections will be displayed as shown in the following image.
Figure 2: Recurrence Editor with Daily rule and its corresponding date collections.
Please refer the example and recurrence helper class file from the following GitHub links. Example - Recurrence Parser Class file - Recurrence Helper
|
2X faster development
The ultimate ASP.NET MVC UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.