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