2009 & 53 Weeks

4 posts, 0 answers
  1. Jean-Yves
    Jean-Yves avatar
    69 posts
    Member since:
    Feb 2009

    Posted 26 Jan 2010 Link to this post

    Hello,

    The year 2009 had 53 weeks and in the telerik component count only 52.
    So, now in 2010, I have 1 week gap in each week.

    I did something wrong ?

    Thank you !
  2. Dimo
    Admin
    Dimo avatar
    8474 posts

    Posted 26 Jan 2010 Link to this post

    Hello Jean-Yves,

    In order to make RadCalendar apply week numbers according to the ISO 8601 standard, please use the approach demonstrated below.

    By default RadCalendar does not apply week numbers according to the ISO standard, because the ASP.NET framework itself does not do this.


    <%@ Page Language="C#" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
      
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      
    <script runat="server">
          
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Globalization.CultureInfo c = new System.Globalization.CultureInfo(RadCalendar1.CultureInfo.ToString());
            c.DateTimeFormat.CalendarWeekRule = System.Globalization.CalendarWeekRule.FirstFourDayWeek;
            RadCalendar1.CultureInfo = c;
        }
          
    </script>
      
    <head runat="server">
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>RadControls for ASP.NET AJAX</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
      
    <telerik:RadCalendar ID="RadCalendar1" runat="server" FirstDayOfWeek="Monday" />
      
    </form>
    </body>
    </html>


    Best wishes,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Jonathan Puddle
    Jonathan Puddle avatar
    4 posts
    Member since:
    Apr 2010

    Posted 26 Apr 2010 Link to this post

    Hi, this modification only works when using the full calendar. We're just using the datepicker control, and so it doesn't work. Please advise how we can tweak just the datepicker control when used in an edit form.
  4. Jean-Yves
    Jean-Yves avatar
    69 posts
    Member since:
    Feb 2009

    Posted 26 Apr 2010 Link to this post

    Hello Jonathan,

    In fact I had the problem on each control too.

    So I did a Class :

    public class RadCalendarLocalizer  
        {  
            public static void localize(RadCalendar radCalendar)  
            {  
                System.Globalization.CultureInfo c = new System.Globalization.CultureInfo(radCalendar.CultureInfo.ToString());  
                c.DateTimeFormat.CalendarWeekRule = System.Globalization.CalendarWeekRule.FirstFourDayWeek;  
                radCalendar.CultureInfo = c;  
            }  
            public static void localize(RadDatePicker radDatePicker)  
            {  
                System.Globalization.CultureInfo c = new System.Globalization.CultureInfo(radDatePicker.Calendar.CultureInfo.ToString());  
                c.DateTimeFormat.CalendarWeekRule = System.Globalization.CalendarWeekRule.FirstFourDayWeek;  
                radDatePicker.Calendar.CultureInfo = c;  
            }  
            public static void localize(RadTimePicker radTimePicker)  
            {  
                System.Globalization.CultureInfo c = new System.Globalization.CultureInfo(radTimePicker.Calendar.CultureInfo.ToString());  
                c.DateTimeFormat.CalendarWeekRule = System.Globalization.CalendarWeekRule.FirstFourDayWeek;  
                radTimePicker.Calendar.CultureInfo = c;  
            }  
            public static void localize(RadDateTimePicker radDateTimePicker)  
            {  
                System.Globalization.CultureInfo c = new System.Globalization.CultureInfo(radDateTimePicker.Calendar.CultureInfo.ToString());  
                c.DateTimeFormat.CalendarWeekRule = System.Globalization.CalendarWeekRule.FirstFourDayWeek;  
                radDateTimePicker.Calendar.CultureInfo = c;  
            }  
        } 

    And each time I use a componant I localize them.
    For me it works :)

Back to Top