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

Accessing RecurrenceRule in AppointmentInsert event

2 Answers 97 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Nathan
Top achievements
Rank 1
Nathan asked on 20 Dec 2016, 05:02 PM

I am setting a default recurrence rule in the FormCreated event when opening an advanced insert form as described at http://docs.telerik.com/devtools/aspnet-ajax/controls/scheduler/recurrence-editor/server-side-programming/populating-the-recurrence-rule

 

When the Save button is clicked, I am attempting to read the recurrence rule from e.Appointment.RecurrenceRule. This always returns the default rule that I set in FormCreated, even if the user altered the recurrence settings in the form before clicking Save. If I do not set the recurrence rule in FormCreated, this returns the settings that the user chose as expected.

 

Is there any way to set the default recurrence settings that are shown when the form is opened and still access the user's chosen settings in the AppointmentInsert event?

2 Answers, 1 is accepted

Sort by
0
Nathan
Top achievements
Rank 1
answered on 21 Dec 2016, 03:22 PM
Also, more generally, I am trying to show the form for a new recurring event when double-clicking on an empty timeslot. So if there is a way to do that without setting the RecurrenceEditor's recurrence rule in FormCreated, that would also be helpful.
0
Accepted
Veselin Tsvetanov
Telerik team
answered on 23 Dec 2016, 11:11 AM
Hi Nathan,

At the server FormCreated event will be triggered when the form is created and when it is closed, its implementation overrides the changes made by the user. Therefore, all events will be saved with the default Recurrence configuration. As in most cases this is not the desired result, I would suggest you to use the ClientFormCreated even. In that event you could simply access the Recurrence DropDownList and set its selected item to "Daily", for example:
function onFormCreated(sender, args) {
    if (Telerik.Web.UI.SchedulerFormMode.AdvancedInsert == args.get_mode()) {
        var reccurenceDropDown = $find('rs_Form_RecurrentAppointmentDropDown');
        var item = reccurenceDropDown.findItemByText('Daily');
        item.select();
    }
}

Attached you will find a simple implementation of the above.

Regards,
Veselin Tsvetanov
Telerik by Progress
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.
Tags
Scheduler
Asked by
Nathan
Top achievements
Rank 1
Answers by
Nathan
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or