无法在MVC中的文本框中显示日期时间值

时间:2018-11-21 10:22:50

标签: asp.net-mvc asp.net-mvc-4 jquerydatetimepicker

我喜欢这样的代码 我指的是以下JS

<link href="~/Content/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
<script src="@Url.Content("~/Content/js/jquery-1.11.1.min.js")"></script>
<script src="@Url.Content("~/Content/js/bootstrap.min.js")"></script>
<script src="@Url.Content("~/Content/js/moment.min.js")"></script>
<script src="@Url.Content("~/Content/js/bootstrap-datetimepicker.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
这就是我在代码上实现的方式

$(function () {
        $('#startDatepicker').datetimepicker({
            format: 'YYYY-MM-DD HH:mm'
        });
        $('#EndDatepicker').datetimepicker({
            useCurrent: false, //Important! See issue #1075
            format: 'YYYY-MM-DD HH:mm',
        });
        $("#startDatepicker").on("dp.change", function (e) {
            $('#startDatepicker').data("DateTimePicker").minDate(new Date());
        });
        $("#EndDatepicker").on("dp.change", function (e) {
            $('#EndDatepicker').data("DateTimePicker").minDate(new Date());
        });
    });

<div class='input-group date' id='startDatepicker'>
    @Html.TextBoxFor(c => c.StartDT,new { @class = "form-control", @id = "StartDT"})
    <span class="input-group-addon">
        <span class="glyphicon glyphicon-calendar"></span>
    </span>
</div>

及其来自模型的绑定值 On browser textbox value

,但未在文本框值中显示 empty textbox

帮助我解决此问题

0 个答案:

没有答案