How to get Recurence Rule Object from Recurence Rule String

4 posts, 0 answers
  1. Rahul
    Rahul avatar
    142 posts
    Member since:
    May 2009

    Posted 09 Dec 2010 Link to this post

    Hello


    We are storing recurrence rules string in appointment table. Now we need to generate recurrences for the rule stored in appointment table.  We try to create object of recurrence rule with the examples found in your forum by passing the RecurrencePattern  object as in posted code below but it gives an error of having no such constructor. is there any other way to get recurrences for recurrence rule string.

    Appointment fitnessAppointment = new Appointment();
    fitnessAppointment.Subject = "Fitness";
    fitnessAppointment.Start = DateTime.Now;
    fitnessAppointment.End = DateTime.Now.AddHours(2);

    RecurrencePattern recurrencePattern = new RecurrencePattern();
    recurrencePattern.Frequency = RecurrenceFrequency.Weekly;
    recurrencePattern.MaxOccurrences = 30;
    recurrencePattern.DaysOfWeekMask = RecurrenceDays.Monday | RecurrenceDays.Wednesday | RecurrenceDays.Friday;

    RecurrenceRule recurrenceRule = new RecurrenceRule( recurrencePattern );

    fitnessAppointment.RecurrenceRule = recurrenceRule;


    we are using this code but gives an error that no such constructor is available for this class.



    Thanks
    Regards
    Rahul M
  2. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 14 Dec 2010 Link to this post

    Hi rahul,

    Here is a snippet that should give you an idea:
    RecurrenceRule parsedRule; 
    RecurrenceRule.TryParse(recurrenceString, out parsedRule);


    Regards,
    Nikolay Tsenkov
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. Michael
    Michael avatar
    1 posts
    Member since:
    Feb 2012

    Posted 23 Feb 2012 Link to this post

    We are converting from another calendar control to the telerik scheduler.  We have historic appointments that are stored in separate fields in the database (frequency, maxoccurrences, interval, etc).  We need the ability to display these old appointments in the new telerik scheduler.  In order to do this we need to convert the data from the database into the telerik recurrence string.  We would like to use the code below.

    RecurrencePattern recurrencePattern = new RecurrencePattern();
    recurrencePattern.Frequency = RecurrenceFrequency.Weekly;
    recurrencePattern.MaxOccurrences = 30;
    recurrencePattern.DaysOfWeekMask = RecurrenceDays.Monday | RecurrenceDays.Wednesday | RecurrenceDays.Friday;

    RecurrenceRule parsedRule; 
    RecurrenceRule.TryParse(recurrenceString, out parsedRule);

    In the code above how can I get the recurrenceString?
  4. Plamen
    Admin
    Plamen avatar
    3079 posts

    Posted 28 Feb 2012 Link to this post

    Hi Michael,

    Here is a sample code how the recurrence rule can be added to an appointment:

    RecurrenceRule newDayly = new DailyRecurrenceRule(interval, range);
          newAppointment.RecurrenceRule = newDayly.ToString();

    You can also refer to the Populating the Recurrence rule help topic.

    Hope this will be helpful.

    Regards,
    Plamen Zdravkov
    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