Search code examples
ektron

Ektron WebCalendar: change time range for Day view


Using Ektron 9.0 SP2

Is it possible to change the time range for an Ektron WebCalendar in Day view? The displayed time periods are the hours from 8am to 5pm. I would like to know if the range can be changed and, if so, how to apply this change. I looked through the Ektron Web Reference documentation and skimmed through the WebCalendar properties, but could not find anything useful.

Thank you in advance for any input.


Solution

  • I realized that what I was trying to change is a property of the Telerik RadScheduler the Ektron WebCalendar is built upon. With some trial and error, I was able to finally reach the RadSchedular and edit its DayStartTime and DayEndTime properties to change hour range for the WebCalendar's Day View.

    Below is the code I used to find the RadScheduler.

    //Using a foreach loop through the WebCalendar as I am not sure if the order of its Controls property changes at all, but we want the UpdatePanel as that holds the RadScheduler.    
    foreach (Control control in uxWebCalendar.Controls)
        {
            if (control is UpdatePanel)
            {
                Control subControl = control;
                Control subSubControl = subControl.Controls[0];
                Telerik.Web.UI.RadScheduler radScheduler = subSubControl.Controls[0] as Telerik.Web.UI.RadScheduler;
    
                //This results makes is to set the start time as 7am
                TimeSpan timeStart = new TimeSpan(0, 7, 0, 0, 0);
                //To show the 8pm slot, you have to end the time at 9pm
                TimeSpan timeEnd = new TimeSpan(0, 21, 0, 0, 0);
    
                radScheduler.DayStartTime = timeStart;
                radScheduler.DayEndTime = timeEnd;
    
                break;
            }
        }