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

RadScheduler

1 Answer 112 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
rmoynihan
Top achievements
Rank 1
rmoynihan asked on 13 Aug 2008, 12:52 PM
Hi,

I would like to customize the Rad Scheduler so that when the user inserts a new appointment the SchedulerDefaulf Form will be customized as follows, 

1. the Start Date and end Date will be the same date as opposed to the end date set to 1 day after the start date.

2. The 'All day event' checkbox will not be selected and the time textboxes will be enabled.

What changes in do I need to SchedulerDefaultForm.ascx.cs to achieve this?

Also For the Rad Scheduler API what is considered a week day in the Recurrence Pattern, as I am in the UAE where the working week is Sunday to Thursday. Can I set these days as the work week so when If the recurrence pattern is week days I'll know its Sunday to Thursday.

Thanks,

Ronan

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 15 Aug 2008, 12:33 PM
Hi rmoynihan,

In order to achieve the first two goals you need to handle the FormCreated event of RadScheduler, find the respective controls and manipulate them per the requirements.

Below is a sample implementation of the FormCreated event handler (provided that the AdvancedForm is structured as the one in the Live Demo: 'Customizing the Advanced Template').

        protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e) 
        { 
            if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || 
                e.Container.Mode == SchedulerFormMode.AdvancedInsert) 
            { 
                RadDatePicker startDate =  
                    e.Container.Controls[1].Controls[0].Controls[1].Controls[2].Controls[1].FindControl("StartDate"as RadDatePicker; 
                RadDatePicker endDate =  
                    e.Container.Controls[1].Controls[0].Controls[1].Controls[2].Controls[1].FindControl("EndDate"as RadDatePicker; 
 
                if (startDate != null && endDate != null
                { 
                    startDate.DbSelectedDate= DateTime.Today; 
                    endDate.DbSelectedDate = DateTime.Today.AddDays(1); 
                } 
 
                RadDatePicker startTime =  
                    e.Container.Controls[1].Controls[0].Controls[1].Controls[2].Controls[1].FindControl("StartTime"as RadDatePicker; 
                RadDatePicker endTime =  
                    e.Container.Controls[1].Controls[0].Controls[1].Controls[2].Controls[1].FindControl("EndTime"as RadDatePicker; 
                CheckBox allDayEvent = 
                   e.Container.Controls[1].Controls[0].Controls[1].Controls[2].Controls[1].FindControl("AllDayEvent"as CheckBox; 
 
                if (startTime != null && endTime != null && allDayEvent != null
                { 
                    startTime.Enabled = true
                    endTime.Enabled = true
                    allDayEvent.Checked = false
                } 
            } 
        } 

Similarly, when you are building the Recurrence Rule of the Inserted/Edited Appointment you could find the Recurrence Rule controls and create the WeekMask manually with the Days you would like to be counted as Week Days. Consider the modified DaysOfWeekMask property, defined in the SchedulerDefaultForm control:

        protected RecurrenceDay DaysOfWeekMask 
        { 
            get 
            { 
                switch (Frequency) 
                { 
                    case RecurrenceFrequency.Daily: 
                        RecurrenceDay finalMask = 
                            RecurrenceDay.Sunday | 
                            RecurrenceDay.Monday | 
                            RecurrenceDay.Tuesday | 
                            RecurrenceDay.Wednesday | 
                            RecurrenceDay.Thursday; 
 
                        return (RepeatEveryWeekday.Checked) ? finalMask : RecurrenceDay.EveryDay; 
                        ..... 
                return RecurrenceDay.None; 
            } 
        } 

By default, RecurrenceDay.WeekDays contains the days from Monday to Friday, so it is not useful in your case.

Regards,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
rmoynihan
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or