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

Week numbers

1 Answer 85 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
PÄR-OSKAR HOLMGREN
Top achievements
Rank 1
PÄR-OSKAR HOLMGREN asked on 03 Jul 2008, 02:43 PM
Hi

We're currently using the radscheduler in a project and have recieved a request for week numbers to be displayed in Day and Week view. Is there date format for week number or a way to insert a string containing a week number in the header?

with kind regards

/Truls Bråhammar
Inka Interactive

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 04 Jul 2008, 11:40 AM
Hello PÄR-OSKAR HOLMGREN,

RadScheduler does not support this functionality out-of-the-box but the desired effect still can be achieved in the following way:
  1. Override the OnPreRenderComplete event handler of the page.
  2. Get the current week number in the event handler.
  3. Put the week number in the text of the Header wherever it is appropriate.
Below is the code of the overridden OnPreRenderComplete event handler:

    protected override void OnPreRenderComplete(EventArgs e) 
    { 
        base.OnPreRenderComplete(e); 
 
        LiteralControl literal = (LiteralControl) RadScheduler1.Controls[0].Controls[0].Controls[2].Controls[0]; 
 
        int weekNumber = this.GetWeekNumber(this.RadScheduler1.SelectedDate); 
 
        if ((this.RadScheduler1.SelectedView == SchedulerViewType.DayView) || 
            (this.RadScheduler1.SelectedView == SchedulerViewType.WeekView)) 
        { 
            literal.Text += " Week#" + weekNumber.ToString(); 
        } 
    } 

The tricky part here is to find the LiteralControl where the Date is displayed in the Header. This - RadScheduler1.Controls[0].Controls[0].Controls[2].Controls[0] - is exactly where the control is located.

As you see, this approach is not the best. We will surely consider including a support for changing the Header Date Format in a more flexible way in future versions of RadScheduler.

All the best,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
PÄR-OSKAR HOLMGREN
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or