3

I,

I have a kendoRecurrenceEditor in my page and a calendar from telerik.

The kendoRecurrenceEditor is placed in a RadWindow and works fine but i can't get the pattern when i click "OK".

Basically, i want the result pattern of the kendoRecurrenceEditor. Can be via JQuery or Server Side

Any help? Thanks, Bruno F.

2 Answers2

0

SchedulerEvent has recurrenceRule field. This would have recurrence patten user selected.

Hope that helps.

RK911
  • 152
  • 1
  • 5
0

You just need to make sure that you bind that recurrence rule to some property on your model that you are passing back to the server. Server should be able to serialize it into an object:

public abstract class RecurrenceRule : ISerializable, IEquatable<RecurrenceRule>

If it is not able to serialize it and you get just the string pattern and you can convert into the recurrence rule like this (I had a problem with missing parameters in the patter so I made a method as following):

private RecurrenceRule GetParsedRecurrenceRule(DateTime start, DateTime end, string recurrenceRuleToParse)
        {
            // Parse recurrence rule.
            var recurrenceRule = string.Format(
                "DTSTART:{0:yyyyMMddTHHmmssZ}\r\nDTEND:{1:yyyyMMddTHHmmssZ}\r\nRRULE:{2}", start, end,
                recurrenceRuleToParse);
            // Add interval if it is missing otherwise the parser will fail.
            if (!recurrenceRule.Contains("INTERVAL="))
            {
                recurrenceRule = string.Format("{0};INTERVAL=1", recurrenceRule);
            }

            // Fix for daily recurrence that was not working properly due to missing BYDAY parameter.
            if (recurrenceRule.Contains("FREQ=DAILY") && !recurrenceRule.Contains("BYDAY="))
            {
                recurrenceRule = string.Format("{0};BYDAY=MO,TU,WE,TH,FR,SA,SU", recurrenceRule);
            }

            // Fix of missing never option - default to COUNT=1
            if (!recurrenceRule.Contains("COUNT=") && !recurrenceRule.Contains("UNTIL="))
            {
                recurrenceRule = string.Format("{0};COUNT=1", recurrenceRule);
            }

            RecurrenceRule parsedRule;
            bool parseResult = RecurrenceRule.TryParse(recurrenceRule, out parsedRule);

            return parsedRule;
        }
Jakub Holovsky
  • 6,543
  • 10
  • 54
  • 98