RadDatePicker Arabic with GregorianCalendar not working

5 posts, 1 answers
  1. Gideon
    Gideon avatar
    7 posts
    Member since:
    Jul 2009

    Posted 11 Jun 2010 Link to this post

    Hi,

    I'm currently using RadControls for ASP.NET AJAX Q2 2009 NET35. I can make RadCalendar with GregorianCalendar and Arabic language working, but somehow the RadDatePicker is not showing when I use the same method.

    Below is my code, very simple, only using 1 RadCalendar and 1 RadDatePicker and two buttons to switch between language. After switch to arabic, the RadDatePicker didn't work at all.

    I need to use arabic month name and day name, but I want the calendar dates to be in Gregorian format, not hijri format. Do I need to change javascript code too? Or just the code-behind?

    Default.aspx:
     
    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %> 
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
     
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head runat="server"
        <title></title> 
    </head> 
    <body> 
        <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server"
        </asp:ScriptManager> 
        <div> 
        <asp:Button ID="Button1" runat="server" Text="en" onclick="Button1_Click" /> 
        <asp:Button ID="Button2" runat="server" Text="ar" onclick="Button2_Click" /> 
        <br /> 
        <telerik:RadCalendar ID="RadCalendar1" runat="server"
        </telerik:RadCalendar> 
        <telerik:RadDatePicker ID="RadDatePicker1" runat="server"
        </telerik:RadDatePicker> 
        </div> 
        </form> 
    </body> 
    </html> 
     

    Default.aspx.cs:
    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using System.Globalization; 
     
    public partial class _Default : System.Web.UI.Page  
        protected void Page_Load(object sender, EventArgs e) 
        { 
     
        } 
        protected void Button1_Click(object sender, EventArgs e) 
        { 
            CultureInfo info = new CultureInfo("en-US"); 
            System.Threading.Thread.CurrentThread.CurrentCulture = info; 
            System.Threading.Thread.CurrentThread.CurrentUICulture = info; 
            GregorianCalendar calendar = new GregorianCalendar(); 
            info.DateTimeFormat.Calendar = calendar; 
            this.RadCalendar1.CultureInfo = info; 
            this.RadDatePicker1.Culture = info; 
            this.RadDatePicker1.Calendar.CultureInfo = info; 
        } 
        protected void Button2_Click(object sender, EventArgs e) 
        { 
            CultureInfo info = new CultureInfo("ar-SA"); 
            System.Threading.Thread.CurrentThread.CurrentCulture = info; 
            System.Threading.Thread.CurrentThread.CurrentUICulture = info; 
            GregorianCalendar calendar = new GregorianCalendar(); 
            info.DateTimeFormat.Calendar = calendar; 
            this.RadCalendar1.CultureInfo = info; 
            this.RadDatePicker1.Culture = info; 
            this.RadDatePicker1.Calendar.CultureInfo = info; 
        } 
     

    Best regards,
    Omar Suria
  2. Gideon
    Gideon avatar
    7 posts
    Member since:
    Jul 2009

    Posted 14 Jun 2010 Link to this post

    Anyone please?
    I need to fix a.s.a.p., need help...

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    1873 posts

    Posted 15 Jun 2010 Link to this post

    Hello Omar,

    I checked the sample project you sent me but I could not replicate the issue you described. I am attaching screenshots of what I saw. Please, tell me if I am missing something out. Is there a specific way to trigger the erroneous behavior?


    All the best,
    Tsvetina
    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.
  5. Gideon
    Gideon avatar
    7 posts
    Member since:
    Jul 2009

    Posted 16 Jun 2010 Link to this post

    Dear Tsvetina,

    Sorry, it seems to be issue with IE 8 on Windows 7 64x, when I changed browser it worked fine. The RadDatePicker calendar position is overlapping with the previous RadCalendar on the top of it.

    Anyway, I found a way to fix this issue in the quick way, to set all the RadCalendar and RadDatePicker in the solution to always use Gregorian Calendar can be done with this code:

    Thread.CurrentThread.CurrentCulture.DateTimeFormat.Calendar = new GregorianCalendar(); 
    Thread.CurrentThread.CurrentUICulture.DateTimeFormat.Calendar = new GregorianCalendar(); 

    This way, no matter what the language culture, the calendar will be in GregorianCalendar format. Hope this info can be helpful for anyone who stumble upon this problem too.

    Cheers,
    Omar Suria
  6. Ahmad
    Ahmad avatar
    2 posts
    Member since:
    Aug 2016

    Posted 13 Aug Link to this post

    thanks a lot man
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017