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

RadDatePicker Arabic with GregorianCalendar not working

4 Answers 205 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Gideon
Top achievements
Rank 1
Gideon asked on 11 Jun 2010, 11:10 AM
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

4 Answers, 1 is accepted

Sort by
0
Gideon
Top achievements
Rank 1
answered on 15 Jun 2010, 02:41 AM
Anyone please?
I need to fix a.s.a.p., need help...

0
Accepted
Tsvetina
Telerik team
answered on 15 Jun 2010, 02:55 PM
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.
0
Gideon
Top achievements
Rank 1
answered on 16 Jun 2010, 05:03 AM
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
0
Ahmad
Top achievements
Rank 1
answered on 13 Aug 2016, 01:39 PM
thanks a lot man
Tags
Calendar
Asked by
Gideon
Top achievements
Rank 1
Answers by
Gideon
Top achievements
Rank 1
Tsvetina
Telerik team
Ahmad
Top achievements
Rank 1
Share this question
or