我正在开发一个asp.net mvc-4 Web应用程序。我在我的观点中有以下字段: -
<div >
<span class="f"> @Html.DisplayNameFor(model => model.CustomerApprovalDate) </span>
@Html.TextBoxFor(model => model.CustomerApprovalDate, new { @class = "datepicker" ,@Value =Model != null ? Model.CustomerApprovalDate.ToString("dd-mm-yy"):string.Empty})
@Html.ValidationMessageFor(model => model.CustomerApprovalDate)
</div>
我定义了以下jquery datepicker: -
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
<script type="text/javascript">
$(document).ready(function () {
$(".datepicker").datepicker({
dateFormat: 'dd-mm-yy',
showOn: "both"
});
目前,当我尝试输入日期,例如31 05 2016时,我会在尝试提交表单时收到以下错误: -