我在Kendo Tabstrip中遇到了Kendo Datepicker的问题。以下是我的代码。在运行时,我得到一个“错误:无效的模板:”错误。关于如何让它发挥作用的任何想法?
<script id="EditDevelopmentPlanTemplate" type="text/kendo-tmpl">
@(Html.Kendo().TabStrip()
.Name("EditDevelopmentPlanTabStrip")
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(items =>
{
items.Add().Text("Quarterly Meeting Notes").Content(@<text>
<div class="editor-label">
@Html.LabelFor(m => m.EDP_Q1MeetingNotes, new { style = "width:470px" })
</div>
<div class="editor-field">
@Html.TextAreaFor(m => m.EDP_Q1MeetingNotes, new { style = "width: 470px" })
</div>
<div class="editor-label">
@Html.LabelFor(m => m.EDP_Q1MeetingDate)
</div>
<div class="editor-label">
@Html.Kendo().DatePickerFor(m => m.EDP_Q1MeetingDate)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.EDP_Q2MeetingNotes, new { style = "width:470px" })
</div>
<div class="editor-field">
@Html.TextAreaFor(m => m.EDP_Q2MeetingNotes, new { style = "width: 470px" })
</div>
<div class="editor-label">
@Html.LabelFor(m => m.EDP_Q2MeetingDate)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.EDP_Q3MeetingNotes, new { style = "width:470px" })
</div>
<div class="editor-field">
@Html.TextAreaFor(m => m.EDP_Q3MeetingNotes, new { style = "width: 470px" })
</div>
<div class="editor-label">
@Html.LabelFor(m => m.EDP_Q3MeetingDate)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.EDP_Q4MeetingNotes, new { style = "width:470px" })
</div>
<div class="editor-field">
@Html.TextAreaFor(m => m.EDP_Q4MeetingNotes, new { style = "width: 470px" })
</div>
<div class="editor-label">
@Html.LabelFor(m => m.EDP_Q4MeetingDate)
</div>
</text>);
}).ToClientTemplate())
</script>
答案 0 :(得分:0)
好吧,对于那些可能遇到过这种情况的人来说,脚本末尾的})。ToClientTemplate())不会削减它。为了使DateTimePicker控件与模板一起使用,您必须在DateTimePicker声明的末尾添加.ToClientTemplate(),如下所示:
@Html.Kendo().DatePickerFor(m => m.Date).ToClientTemplate()