0

DatePicker 在项目周围工作,但不能在模式中工作。模态是部分视图。

这在编辑器模板中。

日期时间.cshtml

@model System.DateTime?
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, new { @class = "editor-field" })

    <script type="text/javascript">
        if (typeof (jQuery) == 'function') {
            $(function () {
                if ($.datepicker) {
                    $('#@this.ViewData.TemplateInfo.GetFullHtmlFieldId("")')
                    .datepicker();
                }
            });
        }
    </script>
4

1 回答 1

0

在您的编辑器模板上尝试此代码

@model System.DateTime?
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, new { @class = "editor-field picker" })

并在共享视图上调用这样的脚本

    <script type="text/javascript">
        if (typeof (jQuery) == 'function') {
            $(function () {
                if ($.datepicker) {
                    $('input.picker')
                    .datepicker();
                }
            });
        }
    </script>
于 2012-07-18T00:04:44.120 回答