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

Recurrence Editor Issue

4 Answers 101 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 30 Jul 2012, 09:39 PM

I have an issue with a custom Advanced Form and the Recurrence Editor Control.  I had the recurrence editor defaulting to being checked as 'End By Day'.  This is all working no problem when I choose New Appointment from the Context Menu or double click for a new appointment.  However, when we choose 'New Recurring Appointment' from the context menu it always chooses 'No End Date' as the selection criteria.  My question is how can I get the 'End By Date' to be selected when we open a 'New Recurring Appointment' from the context menu?

We have the following in the Page Pre Render when it is not initialized:

Dim endDateRadio As RadioButton = DirectCast(AppointmentRecurrenceEditor.FindControl("RepeatUntilGivenDate"), RadioButton)
endDateRadio.Checked = True

 

4 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 01 Aug 2012, 02:10 PM
Hello Chris,

 
You can check the 'End By Day' checkbox in the onClientFormCreated event as in the code below:

function schedulerFormCreated(scheduler, eventArgs) {
 
         // Create a client-side object only for the advanced templates
         var mode = eventArgs.get_mode();
         if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||
                 mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
             var $ = $telerik.$;
             var checkbox = $("[id$='RepeatUntilGivenDate']");
             checkbox.attr("checked", "checked");
             // Initialize the client-side object for the advanced form
             var formElement = eventArgs.get_formElement();

Hope this will be helpful.

Greetings,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Chris
Top achievements
Rank 1
answered on 02 Aug 2012, 03:52 AM
Thanks, this worked.  One note, I slightly changed the code so it only makes the change if we are adding a new appointment series so it does not choose the number of occurrences if you dont change the code to the following...
if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert)
{
             var $ = $telerik.$;
             var checkbox = $("[id$='RepeatUntilGivenDate']");
             checkbox.attr("checked", "checked");

Thanks for the help.

Chris
0
Sarah Shum
Top achievements
Rank 1
answered on 16 Jun 2015, 06:19 PM

I tried with the above code, it didn't resolve the default check "END BY", can you please see the code below:

 

<script type="text/javascript">
function OnClientFormCreated(sender, eventArgs) {
$telerik.$(".rsAdvRecurrenceRangePanel .rsAdvOptionsPanel ul li:first-child").hide();
$telerik.$(".rsAdvRecurrenceRangePanel .rsAdvOptionsPanel ul li:nth-child(2)").hide();
$telerik.$('.rsAdvWeekly_WeekDays li:first-child').hide();
$telerik.$('.rsAdvWeekly_WeekDays li:last-child').hide();

}
function pageLoad() {
var $ = $telerik.$;
$(".rsRecurrenceOptionList").children().each(function (i) {
if (i < 2)
$(this).hide();
});
var $ = $telerik.$;
$(".rsRecurrenceOptionList").children().each(function (i) {
if (i ==4)
$(this).hide();
});
}
function OnClientFormCreated(sender, args) {
// Create a client-side object only for the advanced templates
var mode = eventArgs.get_mode();
if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert || mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
var $ = $telerik.$;
var checkbox = $("[id$='RepeatUntilGivenDate']");
checkbox.attr("checked", "checked");
// Initialize the client-side object for the advanced form
var formElement = eventArgs.get_formElement();
}
}

</script>

<script type="text/javascript">
function OnClientFormCreated(sender, args) {
$telerik.$(".rsAdvRecurrenceRangePanel .rsAdvOptionsPanel ul li:first-child").hide();
$telerik.$(".rsAdvRecurrenceRangePanel .rsAdvOptionsPanel ul li:nth-child(2)").hide();
$telerik.$('.rsAdvWeekly_WeekDays li:first-child').hide();
$telerik.$('.rsAdvWeekly_WeekDays li:last-child').hide();
var $ = $telerik.$;
var mode = args.get_mode();
if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert || mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
var recurrenceEditorJqueryObj = $("[id$='RangeEndDate']");
var recurrenceEditor = $find(recurrenceEditorJqueryObj.attr("id"));
var today = new Date();
today.setMonth(today.getMonth() + 6);
recurrenceEditor.set_selectedDate(today);


}
}
 
</script>

0
Plamen
Telerik team
answered on 19 Jun 2015, 05:36 AM
Hello,

Here is the code that worked at my side:
function OnClientFormCreated(sender, args) {
             var $ = $telerik.$;
             $(".rsAdvRecurrenceRangePanel .rsAdvOptionsPanel ul li:first-child").hide();
             $(".rsAdvRecurrenceRangePanel .rsAdvOptionsPanel ul li:nth-child(2)").hide();
             $('.rsAdvWeekly_WeekDays li:first-child').hide();
             $('.rsAdvWeekly_WeekDays li:last-child').hide();
             
             // Create a client-side object only for the advanced templates
             var mode = args.get_mode();
             if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||
                 mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
                 var $ = $telerik.$;
               
                 var checkbox = $("[id$='RepeatUntilGivenDate']");
                 checkbox.attr("checked", "checked");
                 // Initialize the client-side object for the advanced form
 
             }
         }

I am also attaching my test page.

Regards,
Plamen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Scheduler
Asked by
Chris
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Chris
Top achievements
Rank 1
Sarah Shum
Top achievements
Rank 1
Share this question
or