特定のDateTime Modelプロパティに「リモート」検証属性を使用しているときに、不審な動作が発生しました。DateTimeのMVCモデルのバインドがGETまたはPOSTを使用して異なる
サーバー側後述のように、私のアプリケーションの文化が定義されている:
protected void Application_PreRequestHandlerExecute()
{
if (!(Context.Handler is IRequiresSessionState)){ return; }
Thread.CurrentThread.CurrentCulture = new CultureInfo("nl-BE");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("nl-BE");
}
クライアント側後述のように、私のアプリケーションの文化が定義されています
Globalize.culture("nl-BE");
ケース1:
をモデルプロパティ
[Remote("IsDateValid", "Home")] public DateTime? MyDate { get; set; }
コントローラーアクション
public JsonResult IsDateValid(DateTime? MyDate) { // some validation code here return Json(true, JsonRequestBehavior.AllowGet); }
IsDateValid
方法をデバッグしながら、05/10/2013
としてUIに入力された日付(10月5日2013)10/05/2013
(5月10日、2013)
ケース2:
モデルプロパティ
[Remote("IsDateValid", "Home", HttpMethod = "POST")] public DateTime? MyDate { get; set; }
コントローラーアクション
[HttpPost] public JsonResult IsDateValid(DateTime? MyDate) { // some validation code here return Json(true); }
IsDateValid
方法をデバッグしながら、05/10/2013
としてUIに入力された日付(10月5日2013)05/10/2013
(10月5日と解釈正しくです2013)
makの設定がありません必要に応じて「標準的な」GETリモート検証作業を行いますか?
デバッグ –