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

[Solved] MonthView, Changing Month and Recurring Appointments

3 Answers 126 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
zac
Top achievements
Rank 1
zac asked on 18 Jun 2008, 09:54 PM
Hi,

I'm pretty happy with where I've managed to get with the Scheduler control so far but have couple of things still to learn. I have restricted the control to display in month view and I've got the appointment management working fine (inserting, modifying and deleting both individual and recurring appointments). However, if I have an appointment with a weekly recurrence and I try to view the next month it won't show the recurring appointments. The non-recurring appointments display fine.

I'm tempted to hide the header altogether and implement my own 'Next/Previous' functionality - reloading the calendar with each new month, as I know this will work, but I was hoping there was something I'm missing or that there is a quicker/easier way to do this.

On a seperate note, and I'm not too concerned about this, is there a way to restrict recurrence to just weekly and monthly without implementing a full AdvancedInsertTemplate and AdvancedEditTemplate? Is there some property I can set which will give me this level of control?

Thanks in advance.

Cheers,
Zac

3 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 19 Jun 2008, 05:11 PM
Hi,

The only requirement for recurrences to show up is to load the master/first appointment. My guess is that you are doing filtering in your data layer, so you only load appointments that are in the current visible range. Be sure to also include all appointments that have their RecurrenceRule populated. Switching to the next/previous period always causes a re-bind, so you do not need to implement your own custom logic for this.

Hiding the un-needed types of recurrence is easily done:

protected void RadScheduler1_FormCreated(object sender, Telerik.Web.UI.SchedulerFormCreatedEventArgs e) 
    if (e.Container.Mode == SchedulerFormMode.AdvancedInsert || e.Container.Mode == SchedulerFormMode.AdvancedEdit) 
    { 
        RadioButton repeatFrequencyHourly = (RadioButton) e.Container.FindControl("RepeatFrequencyHourly"); 
        repeatFrequencyHourly.Visible = false
 
        RadioButton repeatFrequencyDaily = (RadioButton) e.Container.FindControl("repeatFrequencyDaily"); 
        repeatFrequencyDaily.Visible = false
 
        RadioButton repeatFrequencyYearly = (RadioButton) e.Container.FindControl("repeatFrequencyYearly"); 
        repeatFrequencyYearly.Visible = false
    } 


Best wishes,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
zac
Top achievements
Rank 1
answered on 19 Jun 2008, 09:22 PM
Hi Tsvetomir,

Well, I'm not filtering anything as far as I can tell - I return evey Appointment with a recurrence rule present and leave it up to the schedule control to work out which appointments to show. Below is a version of the SQL I use to retrieve the information:

SELECT 
       EventId 
     , LocationId 
     , EventName 
     , EventDescription 
     , StartDate 
     , EndDate 
     , RecurrenceRule 
     , RecurrenceParentId 
  FROM 
       Event 
 WHERE 
       LocationId = @LocationId 
   AND 
       ( 
            StartDate > @StartDate 
         OR 
            RecurrenceRule <> '' 
       ) 
   AND 
       IsActive = 1 

At no stage do I apply any filtering in the data or business logic layers of my code. Interestingly, when I view the next month, it will sometimes show a recurring appointment but only when it falls within the previous month.

Another thing to note is that, after saving an appointment in a future month I am rebinding the control and when this happens the recurring appointment shows as it should.

Thanks for your help again Tsvetomir. This isn't a major issue so I'm not going to be too concerned if I don't get to the bottom of it (as I mentioned in the last post, I can always manually rebind).

Thanks for the frequency tip as well.

Cheers,
Zac
0
T. Tsonev
Telerik team
answered on 24 Jun 2008, 09:02 AM
Hi,

Your query looks perfectly correct, so it's definitely not the problem here.

The expansion of the recurring appointments depends on several factors and I think we should be able to track the problem to one of them. The easiest way to do this is to attach a handler to the DataBound event. At this point you should verify that the recurring appointment is present in the Appointments collection. It's presence obviously rules out any data-binding issues. If this is the case, but no occurrences are generated, as you mention, then you should inspect the VisibleRangeStart and VisibleRangeEnd properties. These should be consistent with the newly selected period.

I guess we are missing something simple here.

All the best,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
zac
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
zac
Top achievements
Rank 1
Share this question
or