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

[Solved] How Can we know which Recurrence pattern is selected

2 Answers 112 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Rama
Top achievements
Rank 1
Rama asked on 20 May 2008, 01:39 PM
Hi,

I am working on RadScheduler, I am trying to grab the data what user has selected. I am checking on OnAppointmentCreated .

There I can see the Recurrence rule  saying like this

DTSTART:20080520T080000Z
DTEND:20080520T090000Z
RRULE:FREQ=DAILY;COUNT=4;INTERVAL=2;BYDAY=MO,TU,WE,TH,FR,SA,SU

Is there any other way to know whether the user has selected Daily/Weekly/Monthly/Yearly.

Please post me reply ASAP.

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 21 May 2008, 03:54 PM
Hi Rama,

You can parse the recurrence rule and then use the GetType() method:
protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)  
    {  
        if (e.Appointment.RecurrenceState == RecurrenceState.Master)  
        {  
            RecurrenceRule parsedRule;  
            RecurrenceRule.TryParse(e.Appointment.RecurrenceRule, out parsedRule);  
            Response.Write(parsedRule.GetType().ToString());  
        }  
    } 

Or, you can use the String's Contains() method. For example:

protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)  
    {  
        if (e.Appointment.RecurrenceState == RecurrenceState.Master)  
        {              
            if (e.Appointment.RecurrenceRule.Contains("DAILY"))  
            {  
                Response.Write("daily recurrence rule");  
            }  
            else if (e.Appointment.RecurrenceRule.Contains("WEEKLY"))  
            {  
                Response.Write("weekly recurrence rule");  
            }  
            else if (e.Appointment.RecurrenceRule.Contains("MONTHLY"))  
            {  
                Response.Write("monthly recurrence rule");  
            }  
            else if (e.Appointment.RecurrenceRule.Contains("YEARLY"))  
            {  
                Response.Write("yearly recurrence rule");  
            }  
        }  
    } 



All the best,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Rama
Top achievements
Rank 1
answered on 21 May 2008, 05:27 PM
Thanks Peter, I got the answer.
Tags
Scheduler
Asked by
Rama
Top achievements
Rank 1
Answers by
Peter
Telerik team
Rama
Top achievements
Rank 1
Share this question
or