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

RadDateTimePicker Shamsi Date

1 Answer 424 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Rasool
Top achievements
Rank 1
Rasool asked on 03 May 2015, 09:16 AM

Hi Dear

I saw a project that implement shamsi date (Jalali date) on RadDateTimePicker with telerik winform at ease.But i can not implement that on asp.net

 

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TelerikShamsiDate
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            ChangeCulture();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        private static void ChangeCulture()
        {
            CultureInfo c = new CultureInfo("fa-Ir");
            var info = c.DateTimeFormat;

            var p = info.GetType().GetField("calendar", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
            p.SetValue(c.DateTimeFormat, new PersianCalendar());

            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;
            info.ShortestDayNames = new string[] { "ی", "د", "س", "چ", "پ", "ج", "ش" };

            System.Threading.Thread.CurrentThread.CurrentCulture = c;
            System.Threading.Thread.CurrentThread.CurrentUICulture = c;
        }
    }
}

Please show me the right way.

Thanks.

 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 06 May 2015, 01:04 PM
Hello Rasool,

RadCalendar for ASP.NET AJAX supports cultures based on the Gregorian calendar.

RadCalendar Cultures

Please excuse us for any inconvenience caused.

Regards,
Daniel
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Calendar
Asked by
Rasool
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or