Kendo Tabstrip中的Kendo网格的“无效模板”错误

时间:2018-11-16 20:34:08

标签: asp.net-mvc kendo-grid kendo-template kendo-tabstrip

我想将剑道网格放置在剑道标签页内容中。它给出了“无效模板”错误。如果仅在购买选项卡中删除kendo网格,则它可以正常工作。有解决方法吗?

<script id="invoice-template" type="text/kendo-tmpl">
@(Html.Kendo().TabStrip()
    .Name("tabStrip_#=Id#") // Id -> TransportId
    .SelectedIndex(0)
    .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
    .Items(items =>
    {
            items.Add().Text("Commercial").Content(@<text>
                <a href="\\#" class="k-new-commercial k-link k-button" title="New Commercial"><i class="fa fa-document"></i>&nbsp;&nbsp;New Commercial</a>
            </text>);
            items.Add().Text("Purchase").Content(@<text>
                <a href="\\#" class="k-new-purchase k-link k-button" title="New Purchase"><i class="fa fa-document"></i>&nbsp;&nbsp;New Purchase</a>
                <br />
                @(Html.Kendo().Grid<PurchaseInvoiceView>()
                                .Name("grid-purchase_#=Id#")
                                .Columns(columns =>
                                {
                                                    columns.Bound(c => c.InvoiceDate).Title("Date").Width(50).ClientTemplate("#= kendo.toString(InvoiceDate,'dd-MM-yyyy')#");
                                                    columns.Bound(c => c.InvoiceNo).Title("Number").Width(50)
                                                        .Filterable(f => f.Extra(false).Cell(cell => cell.Operator("contains").ShowOperators(false)));
                                                    columns.Bound(c => c.Lot).Title("Lot").Width(40)
                                                        .Filterable(f => f.Extra(false).Cell(cell => cell.Operator("contains").ShowOperators(false)));
                                                    columns.Bound(c => c.Supplier).Title("Group Company").Width(70)
                                                        .Filterable(f => f.Extra(false).Cell(cell => cell.Operator("contains").ShowOperators(false)));
                                                    columns.Bound(o => o.Quantity).Title("Quantity").Width(40).ClientTemplate("#= floatToDouble(Quantity)#");
                                                    columns.Bound(o => o.InvoiceAmount).Title("Amount").Width(40).ClientTemplate("#= floatToMoney(InvoiceAmount)#");
                                                    columns.Bound(c => c.CurrencyAsString).Title("").Width(40);
                                                })
                                .Sortable()
                                .Selectable()
                                .Pageable(pageable => pageable
                                    .Refresh(true)
                                    .PageSizes(true)
                                    .ButtonCount(5))
                                .DataSource(dataSource => dataSource
                                    .Ajax()
                                    .Read(read => read.Action("GetListOfPurchaseInvoice", "PurchaseInvoice", new { Area = "ar", transportId = "#=Id#" }))
                                    .PageSize(200)
                                ).ToClientTemplate())
            </text>);
            items.Add().Text("Cost").Content(@<text>
                <a href="\\#" class="k-new-cost k-link k-button" title="New Cost"><i class="fa fa-document"></i>&nbsp;&nbsp;New Cost</a>
            </text>);
    }).ToClientTemplate())
</script>

1 个答案:

答案 0 :(得分:1)

您的TabStrip已经在模板中。如果我没记错的话,则必须转义TabStrip的#中的每个items。像.Name("grid-purchase_\\#=Id\\#")