yes,
the following example in which I set
<%@ Page Language="C#" Culture="en-US" %>
and
protected void Page_Init(object sender, EventArgs e)
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
}
everything works good:
a) I handle the calendar in en-US standard, the format of the date displayed in the dateField1 is
mm/dd/yyyy
b) the text displayed in the textfield and return by the call of
DateField1.Value.ToString();
is in the right format is
mm/dd/yyyy
but
if i set only
<%@ Page Language="C#" Culture="en-US" %>
and i comment out as follows
protected void Page_Init(object sender, EventArgs e)
{
// System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
}
a) I handle correctly the calendar in en-US standard, the format of the date displayed in the dateField1 is
mm/dd/yyyy
but
b) the text displayed in the textfield and return by the call of
DateField1.Value.ToString();
is in the
wrong format, not en-US but italian format (my OS standard),
dd/mm/yyyy
in few words, the following instructions , if the os configuration is different by en-US
DateField1.Value.ToString();
returns a string in the format not handled by
<%@ Page Language="C#" Culture="en-US" %>
but conforme to the os itself
this is just what I tested
Follows the complete example where you can comment out the line in the Page_Init to see the two behaviour
thanks and hope this is more clear
[if you have the os in another language I should have sense to interchange
it and
en with
yours and
en ]
<%@ Page Language="C#" Culture="en-US" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Init(object sender, EventArgs e)
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
}
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
DateField1.Value = DateTime.Now;
}
}
protected void getDate(object sender, DirectEventArgs e)
{
txtSelDate.Text = "day " + DateField1.Value.ToString();
}
</script>
<!DOCTYPE>
<html>
<head id="Head1" runat="server">
<title>Date example</title>
<script type="text/javascript">
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:DateField ID="DateField1" FieldLabel="Date" runat="server">
</ext:DateField>
<ext:TextField ID="txtSelDate" FieldLabel="Date" runat="server" Visible="true" Text=""
AllowBlank="true" Width="250" SelectOnFocus="true" />
</form>
<ext:Button ID="btnSet" runat="server" Text="set" Icon="Printer" OnDirectClick="getDate" />
</body>
</html>