我在网格中有一个网格。第二个网格与面板内的标签共享。一切都按预期工作,直到我包含我的Tabstrip代码。我在chrome控制台中遇到的错误是:
Uncaught Error: Invalid template:
我的观看代码:
@(Html.Kendo().Grid<MVC.Models.Msg>()
.Name("MsgGrid")
.Events(e => e.DataBound("LineItems_Databound"))
.Columns(columns =>
{
//.ClientTemplate("#= LineItems_Databound(Status)#")
columns.Bound(p => p.ID).Width(50).Hidden(true).HtmlAttributes(new { @class = "Refreshpage" });
columns.Bound(p => p.Company).Title(@"<span tabindex=5>Company</span>").Width(75);
columns.Bound(p => p.Type).Title(@"<span tabindex=5>Type</span>").Width(75);
})
.Pageable(pager => pager.Messages(Info => Info.Empty("No Results Found")))
.Filterable()
.Sortable()
.ClientDetailTemplateId("messagetemplate")
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(6)
.Read(read => read.Action("PaginationGrid", "Controller"))
)
)
<script id="messagetemplate" type="text/kendo-tmpl">
<div class="col-md-6">
@(Html.Kendo().Grid<MVC.Models.MsgDetails>()
.Name("msgid_#=ID#")
.Columns(columns =>
{
columns.Bound(e => e.Type).Width("35%").Filterable(filterable => filterable.Extra(false).Operators(ops => ops.ForString(str => str.Clear().Contains("Contains")))).Encoded(false);
columns.Bound(e => e.Description).Width("35%").Filterable(filterable => filterable.Extra(false).Operators(ops => ops.ForString(str => str.Clear().Contains("Contains")))).Encoded(false);
columns.Bound(e => e.DetailsDate).Width("30%").Format("{0: dd/MM/yyyy HH:mm:ss}").Filterable(filterable => filterable.Extra(false).Operators(ops => ops.ForString(str => str.Clear().Contains("Contains")))).Encoded(false);
})
.HtmlAttributes(new { style = "overflow-y: hidden;" })
.Pageable(pager => pager.Messages(Info => Info.Empty("No Results Found")))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(read => read.Action("DetailPaginationGrid", "Controller", new { MsgID = "#=ID#" }))
)
.Filterable()
.Pageable()
.Sortable(sortable => sortable.AllowUnsort(false))
.ToClientTemplate()
)
</div>
<div class="col-md-6 panel panel-primary">
<div class="panel-heading">
<h2>Messages</h2>
<hr />
</div>
<div class="k-content">
@(Html.Kendo().TabStrip()
.Name("messageStrip")
.Items(tabstrip =>
{
tabstrip.Add()
.Text("msg1")
.Selected(true)
.Encoded(false)
.ContentHtmlAttributes(new { style = "overflow: auto;" })
.Content(@<text>
<div id="message1" class="panel-body">
#=message1#
</div>
</text>);
tabstrip.Add()
.Text("msg2")
.Encoded(false)
.ContentHtmlAttributes(new { style = "overflow: auto;" })
.Content(@<text>
<div id="message2" class="panel-body">
#=message2#
</div>
</text>);
})
)
</div>
</div>
</script>
我的问题是这个标签是如何使它成为无效模板的?我需要在哪里进行更改...谢谢
答案 0 :(得分:0)
您需要将.ToClientTemplate()
添加到与将其添加到网格
@(Html.Kendo().TabStrip()
...
.ToClientTemplate())