0
我需要驗證2個日期:「開始日期」和「結束日期」。 「開始日期」必須從今天到未來,「結束日期」必須等於或大於「開始日期」。我怎樣才能用數據註解來做到這一點?可能嗎?ASP.NET MVC 4使用DataAnnotation進行數據驗證
我需要驗證2個日期:「開始日期」和「結束日期」。 「開始日期」必須從今天到未來,「結束日期」必須等於或大於「開始日期」。我怎樣才能用數據註解來做到這一點?可能嗎?ASP.NET MVC 4使用DataAnnotation進行數據驗證
您可以在波紋管鏈接提到與DataAnnotations
做到這一點:
但,作爲建議,SOLV e這通過Javascript庫更容易比DataAnnotation
s更像Jquery Input Mask
客戶端驗證(如Jquery輸入掩碼)很好,但始終檢查服務器端..(http://stackoverflow.com/ a/15855799/130420) – Guillaume 2015-12-20 08:27:38
你看過自定義驗證屬性嗎? – 2015-03-02 11:31:47
看看這個http://www.dotnetglobe.com/2012_01_01_archive.html – 2015-03-02 11:32:49
http://stackoverflow.com/questions/10887824/greater-than-or-equal-to-today-date-validation-annotation- in-mvc3,http://stackoverflow.com/questions/18577777/mvc-validation-lower-higher-than-other-value,http://stackoverflow.com/questions/19882296/mvc4-data-annotation-compare-兩個日期,http://stackoverflow.com/questions/7025198/mvc-custom-validation-compare-two-dates – CodeCaster 2015-03-02 11:34:28