Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# DataFormatString不';有些日子我不工作_C#_Datetime_Asp.net Core Mvc_Model Binding_Date Format - Fatal编程技术网

C# DataFormatString不';有些日子我不工作

C# DataFormatString不';有些日子我不工作,c#,datetime,asp.net-core-mvc,model-binding,date-format,C#,Datetime,Asp.net Core Mvc,Model Binding,Date Format,我正在为我的一个属性使用以下属性: [DataType(DataType.DateTime), DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")] public DateTime? StartDate { get; set; } 正如您所看到的,我这样指定了日期格式字符串:{0:dd/MM/yyyy} 查看: <div class="form-group"> &l

我正在为我的一个属性使用以下属性:

[DataType(DataType.DateTime), DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime? StartDate { get; set; }
正如您所看到的,我这样指定了日期格式字符串:
{0:dd/MM/yyyy}

查看

<div class="form-group">
    <label asp-for="StartDate" class="col-md-2 control-label"></label>
    <div class="col-md-10">
        <input asp-for="StartDate" class="form-control" />
        <span asp-validation-for="StartDate" class="text-danger"></span>
    </div>
</div>

但是当我在服务器上发布带有以下日期的表单:
17/12/2016
StartDate将为空。有什么想法吗