Articles in this section
Category / Section

How to parse the RecurrenceRule in server side in ASP.NET Web Forms Schedule?

1 min read

You can parse the RecurrenceRule of an appointment from the server-side by making use of a new generic utility class RecurrenceHelper. Within this utility class, GetRecurrenceDateTimeCollection method is defined that generates the date instances based on the RecurrenceRule and recurrence start date of the appointment.

You can find the complete class definition of RecurrenceHelper utility in RecurrenceHelper.cs file and can refer to it in any of the application that is available along with the following sample link.

By referring to the above helper class in your sample project, you can make use of the GetRecurrenceDateTimeCollection method by passing the RecurrenceRule and start date of the recurrence appointment, which automatically generates the date instances as a result.

For example, refer to the following code examples that makes use of the method defined within the RecurrenceHelper class.

Program.cs

class Program
    {
        static void Main(string[] args)
        {
            List<DateTime> dates = new List<DateTime>();
            var RecurrenceRule = "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;COUNT=10;EXDATE=04/08/2015,06/08/2015";
            //Pass the recurrencerule string and the start date of the appointment to this method that returns the dates collection based on the recurrence rule
            dates = RecurrenceHelper.GetRecurrenceDateTimeCollection(RecurrenceRule, DateTime.Now.Date).ToList();
            // Now, the variable “dates” contains the date collection, with that the appointment instances can be created manually.
            foreach (DateTime dt in dates)
            {
                Console.WriteLine(dt.Date.ToString());
            }
            Console.ReadKey();
        }
    }

Sample Link

https://www.syncfusion.com/downloads/support/directtrac/general/ze/ScheduleRecurrenceHelper-16777999471340759250

 

Note:

A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions.The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.

The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls. If you have any queries or require clarifications, please let us know in the comments section below.

You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied