The Nullable DateTime parameter is never bound when an action is called.

I have the following signuture function:

public JsonResult PopulateGrid(int page, Guid? accountId, Guid? systemUserId, Guid? branchId, DateTime? fromDate, DateTime? toDate, HomeVisitType? homeVisitType)

Each individual parameter is associated only with a penalty, except toDatethat will always be zero.
When checking, Request.QueryString["toDate"]it returns the correct value, which is 09/30/2010.
DateTime seems to expect a different format when binding.
What is the correct format?

+3
source share
1 answer

, MM/DD/YYYY, DD/MM/YYYY, , , , . , fromDate, .

, DD/MM/YYYY, , , . , , 10,01 10.01...

- ASP.Net.

" . , URI ( " Uniform " URI) , . , , IM , , ( HTTP 500 - DateTime, ). , , RouteData QueryString yyyy-mm-dd, .

QueryString RouteData , , , . (DateTime.Parse , .) , QueryString RouteData, Uniform 'URI , . URL :? culture = fr-fr & date = 01-10-1990. "

+7

Source: https://habr.com/ru/post/1765668/


All Articles