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

Week Number

1 Answer 64 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Leo
Top achievements
Rank 1
Leo asked on 28 Jul 2010, 08:39 AM
Hi,

is there a way to show (maybe in scheduler's header) the current week number in both Week and Day view mode?

thanks in advance, bye

Leo

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 30 Jul 2010, 04:25 PM
Hello Leo,

Here is one possible solution to this requirement:
<script type="text/javascript">
       function pageLoad() {
           var scheduler = $find('<%= RadScheduler1.ClientID %>');
           if (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.WeekView || scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.DayView) 
           {
               var weekNumber = document.getElementById("HiddenField1").value;
               $telerik.$(".rsHeader h2").text($telerik.$(".rsHeader h2").text() + "week#" + weekNumber);
           }
      }
    
   </script>
   <asp:HiddenField ID="HiddenField1" runat="server" />
   <telerik:RadScheduler runat="server" ID="RadScheduler1" 
       onnavigationcomplete="RadScheduler1_NavigationComplete">
   </telerik:RadScheduler>


protected void Page_Load(object sender, EventArgs e)
   {
       DateTime theDate = RadScheduler1.SelectedDate;
       CultureInfo ciCurr = CultureInfo.CurrentCulture;
       int weekNum = ciCurr.Calendar.GetWeekOfYear(theDate, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
       HiddenField1.Value = weekNum.ToString();
   }
   protected void RadScheduler1_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e)
   {
       DateTime theDate = RadScheduler1.SelectedDate;
       CultureInfo ciCurr = CultureInfo.CurrentCulture;
       int weekNum = ciCurr.Calendar.GetWeekOfYear(theDate, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
       HiddenField1.Value = weekNum.ToString();
   }


Best wishes,
Peter
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Scheduler
Asked by
Leo
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or