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

Set Day of Week in Recurrence Dialog

4 Answers 68 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 02 Jul 2017, 04:38 PM

How can I set it up so that when a user selects a day in the Scheduler, then selects to create a recurring appointment, the Edit Recurring Appointment dialog will, when Weekly recurrence type is selected, set the Day of Week to the Day of Week selected in the calendar, NOT the Day of Week in real-time.

Thank you!

-Scott

4 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Jul 2017, 08:57 AM
Hello Scott, 

Thank you for writing.  

You can force the edit dialog for adding a new appointment to be shown by using a custom SchedulerSelectionBehavior. Here is demonstrated a sample code snippet:
public RadForm1()
{
    InitializeComponent();
    this.radScheduler1.SelectionBehavior = new CustomSchedulerSelectionBehavior(this.radScheduler1);
}
 
public class CustomSchedulerSelectionBehavior : SchedulerSelectionBehavior
{
    public CustomSchedulerSelectionBehavior(RadScheduler scheduler) : base(scheduler)
    {
    }
     
    public override void SelectCell(SchedulerCellElement cell, bool extendSelection)
    {
        base.SelectCell(cell, extendSelection);
        DateTimeInterval dateTimeInterval = new DateTimeInterval();
        dateTimeInterval.Start = cell.Date ;
        dateTimeInterval.End = cell.Date;
        bool isRecurring = true;
        SchedulerResourceCollection resources = cell != null ? cell.View.GetResources() : null;
        this.Scheduler.AddNewAppointmentWithDialog(dateTimeInterval, isRecurring, resources);
    }
}

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Scott
Top achievements
Rank 1
answered on 06 Jul 2017, 03:06 PM

Hi Dess-

Thank you!

-Scott
0
Scott
Top achievements
Rank 1
answered on 18 Mar 2018, 07:30 PM

Hi Dess-

Sorry took so long to get back...  I still need to address the last detail of my problem.  In the Edit Recurrence dialog, in the Recurrence Patten group box, I need it to pop up with Weekly selected and with the Day of the Week set to the Day of Week that was selected in the Scheduler.

Thanks again.

-Scott

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 Mar 2018, 02:56 PM
Hello, Scott, 

Note that the EditRecurrenceDialog loads the information for the existing RecurrenceRule for the appointment that is being edited. Hence, if you are editing an existing appointment, it is normal to have that information coming from the appointment itself.

However, you can create a custom EditRecurrenceDialog and override its LoadSettingsFromEvent method. Here is the appropriate place to load a WeeklyRecurrenceRule to the appointment before the data is loaded to the dialog. Thus, you can control what recurrence rule to be shown in the dialog. Here is a sample code snippet: 
public RadForm1()
{
    InitializeComponent();
 
    this.radScheduler1.RecurrenceEditDialogShowing += radScheduler1_RecurrenceEditDialogShowing;
}
 
CustomEditRecurrenceDialog dialog;
 
private void radScheduler1_RecurrenceEditDialogShowing(object sender, RecurrenceEditDialogShowingEventArgs e)
{
    if (dialog == null)
    {
        dialog = new CustomEditRecurrenceDialog(e.Appointment);
    }
    e.RecurrenceEditDialog = dialog;
}
 
public class CustomEditRecurrenceDialog : EditRecurrenceDialog
{
    public CustomEditRecurrenceDialog(IEvent targetEvent) : base(targetEvent)
    {
         
    }
 
    protected override void LoadSettingsFromEvent(IEvent sourceEvent)
    {
        WeeklyRecurrenceRule rrule = new WeeklyRecurrenceRule();
        rrule.Start = (appointment != null) ? appointment.Start : DateTime.Now;
        rrule.WeekDays = WeekDays.Saturday;
        sourceEvent.RecurrenceRule = rrule;
        base.LoadSettingsFromEvent(sourceEvent);
    }
}



I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler and Reminder
Asked by
Scott
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Scott
Top achievements
Rank 1
Share this question
or