RadDateTimePicker Shamsi Date

2 posts, 0 answers
  1. Rasool
    Rasool avatar
    15 posts
    Member since:
    Mar 2015

    Posted 03 May 2015 Link to this post

    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.

     

  2. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 06 May 2015 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top