problem in RadDatePicker and CultureInfo

2 posts, 0 answers
  1. hesam
    hesam avatar
    26 posts
    Member since:
    May 2008

    Posted 06 Mar 2010 Link to this post

    hi Telerik Group

    when i chenge CultureInfo to persian CultureInfo in first time is currect but when i select date that is GregorianCalendar .
    other problem is year is not persian is GregorianCalendar

    my code for change CultureInfo  :
    System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("fa-IR");  
           System.Globalization.GregorianCalendar  
            System.Globalization.DateTimeFormatInfo info = culture.DateTimeFormat;  
            info.AbbreviatedDayNames = new string[] { "ی""د""س""چ""پ""ج""ش" };  
            info.DayNames = new string[] { "یکشنبه""دوشنبه""ﺳﻪشنبه""چهارشنبه""پنجشنبه""جمعه""شنبه" };  
            info.AbbreviatedMonthNames = new string[] { "فروردین""اردیبهشت""خرداد""تیر""مرداد""شهریور""مهر""آبان""آذر""دی""بهمن""اسفند""" };  
            info.MonthNames = new string[] { "فروردین""اردیبهشت""خرداد""تیر""مرداد""شهریور""مهر""آبان""آذر""دی""بهمن""اسفند""" };  
            info.AMDesignator = "ق.ظ";  
            info.PMDesignator = "ب.ظ";  
            info.ShortDatePattern = "yyyy/MM/dd";  
            info.FirstDayOfWeek = DayOfWeek.Saturday;  
             
            System.Globalization.PersianCalendar cal = new System.Globalization.PersianCalendar();  
     
            typeof(System.Globalization.DateTimeFormatInfo).GetField(  
                "calendar", System.Reflection.BindingFlags.Public |  
                System.Reflection.BindingFlags.Instance |  
                System.Reflection.BindingFlags.NonPublic).SetValue(info, cal);  
     
            object obj = typeof(System.Globalization.DateTimeFormatInfo).GetField(  
                "m_cultureTableRecord", System.Reflection.BindingFlags.Public |  
                System.Reflection.BindingFlags.Instance |  
                System.Reflection.BindingFlags.NonPublic).GetValue(info);  
     
            obj.GetType().GetMethod("UseCurrentCalendar",  
               System.Reflection.BindingFlags.NonPublic |  
               System.Reflection.BindingFlags.Instance).Invoke(obj,  
               new object[] { cal.GetType().GetProperty("ID",  
       System.Reflection.BindingFlags.Instance |  
       System.Reflection.BindingFlags.NonPublic).GetValue(cal, null) });  
     
            typeof(System.Globalization.CultureInfo).GetField("calendar",  
                System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance |  
                System.Reflection.BindingFlags.NonPublic).SetValue(culture, cal);  
     
            System.Threading.Thread.CurrentThread.CurrentCulture = culture;  
     
            RadDatePicker1.Culture = culture;  
            RadDatePicker1.SelectedDate = DateTime.Now.Date;  
            TimeSpan ts = new TimeSpan(3, 30, 00);  
            RadDatePicker1.Calendar.FastNavigationSettings.CancelButtonCaption = "انصراف";  
                RadDatePicker1.Calendar.FastNavigationSettings.OkButtonCaption = "تایید";  
                RadDatePicker1.Calendar.FastNavigationSettings.TodayButtonCaption = "امروز"
    thanks
  2. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 08 Mar 2010 Link to this post

    Hello Hesam,

    I'm not sure that I understand you completely. At this point RadCalendar doesn't support cultures that use calendars other than Gregorian. Unfortunately there is no workaround for this limitation.

    Please excuse us for the inconvenience.

    Best regards,
    Daniel
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top