DatePicker适用于项目,但不适用于模式。模态是部分视图。
这是在编辑器模板中。
DateTime.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>
答案 0 :(得分: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>