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

2009 & 53 Weeks

3 Answers 90 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Jean-Yves
Top achievements
Rank 1
Jean-Yves asked on 26 Jan 2010, 10:54 AM
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 !

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 26 Jan 2010, 11:21 AM
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.
0
Jonathan Puddle
Top achievements
Rank 1
answered on 26 Apr 2010, 11:02 AM
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.
0
Jean-Yves
Top achievements
Rank 1
answered on 26 Apr 2010, 12:01 PM

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 :)

Tags
Calendar
Asked by
Jean-Yves
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Jonathan Puddle
Top achievements
Rank 1
Jean-Yves
Top achievements
Rank 1
Share this question
or