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

Display week numbers in Month View

1 Answer 147 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 20 Jun 2017, 06:21 AM

Hi,

Is it possible to display the week numbers in the month view?
This would also be nice, since you could navigate to the week this way...

Regards
Andreas

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 22 Jun 2017, 03:46 PM
Hello Andreas,

Such functionality would require custom implementation. For example, you can customize the timeslots to show the week number using an approach similar to the Scheduler - Customizing the Time Slots online demo.

Here is a sample implementation of the suggested approach which you could use as a starting point.

<telerik:RadScheduler ID="RadScheduler1" runat="server" SelectedView="MonthView" OnTimeSlotCreated="RadScheduler1_TimeSlotCreated"></telerik:RadScheduler>
public static int GetWeekNumber(DateTime dtPassed)
{
    CultureInfo ciCurr = CultureInfo.CurrentCulture;
    int weekNum = ciCurr.Calendar.GetWeekOfYear(dtPassed, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
    return weekNum;
}
 
protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
{
    if ((sender as RadScheduler).SelectedView == SchedulerViewType.MonthView)
    {
        int currentWeek = GetWeekNumber(e.TimeSlot.Start.Date);
        Label currentWeekLabel = new Label() { Text = " Week " + currentWeek };
        e.TimeSlot.Control.Controls.Add(currentWeekLabel);
    }       
}

Regards,
Peter Milchev
Progress Telerik
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
Andreas
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or