Sep 23, 2013, 12:53 PM
[CLOSED] TimeField am/pm in en-US culture
Hi,
I have multilanguage application, and I have a small problem with TimeField am/pm in en-US culture.
If the culture is en-GB or fr-FR, I get 14:14:00 in server side; but if the cultutre is en-US, I get 2:14 pm
And if I use TimeFrom as a parameter in TestTimeField action, I get error null for this parameter.
Can you tell me how I can work around with this problem?
Here is the test case:
I have multilanguage application, and I have a small problem with TimeField am/pm in en-US culture.
If the culture is en-GB or fr-FR, I get 14:14:00 in server side; but if the cultutre is en-US, I get 2:14 pm
And if I use TimeFrom as a parameter in TestTimeField action, I get error null for this parameter.
Can you tell me how I can work around with this problem?
Here is the test case:
@using System.Globalization
@using System.Threading
@model TimeSpan
@{
Layout = null;
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
}
@(Html.X().ResourceManager())
@(Html.X().FormPanel().ID("MyForm").Layout(LayoutType.Form).Title("Test Form")
.Items(Html.X().TimeField().FieldLabel("Test TimeField").Value(Model)
.Format("HH:mm").ID("TimeFrom"))
.Buttons(Html.X().Button()
.Text("Click Me")
.DirectEvents(d =>
{
d.Click.Url = Url.Action("TestTimeField");
d.Click.FormID = "MyForm";
})))
public ActionResult Index()
{
var model = new TimeSpan(14, 14, 14);
return View(model);
}
public ActionResult TestTimeField(FormCollection values)
{
string TimeFrom = values["TimeFrom"];
return new DirectResult(TimeFrom);
}
Last edited by Daniil; Sep 25, 2013 at 8:25 AM.
Reason: [CLOSED]