剑道,Razor支持问题

时间:2013-01-20 14:31:29

标签: razor kendo-ui

我检查括号,括号100次......我认为它们放置正确但我得到了

“逐字说明符后的关键字,标识符或字符串:@”

<script id="customercontactsTemplate" type="text/kendo-tmpl">
   @(Html.Kendo().TabStrip()
        .Name("TabStripCustomer")
        .SelectedIndex(0)
        .Items(items =>
        {
         items.Add().Text("Contacts").Content(obj => 

                 @(Html.Kendo().Grid<ModelApp.Models.CustomerContacts>()
                    .Name("customercontacts")
                    .Columns(columns =>
                    {
                    columns.Bound(l => l.CustomerContactID);
                    columns.Bound(l => l.CustomerID);
                    columns.Bound(l => l.CustomerContactName);
                    columns.Bound(l => l.CustomerContactPhone);
                    columns.Bound(l => l.CustomerContactDuty);
                    })
                    .DataSource(dataSource => dataSource
                    .Ajax()
                    .Model
                    (model=>{
                        model.Id(l => l.CustomerContactID);
                        model.Field(l=>l.CustomerContactID).Editable(false);
                        model.Field(l => l.CustomerID);
                        model.Field(l => l.CustomerContactName);
                        model.Field(l => l.CustomerContactPhone);
                        model.Field(l => l.CustomerContactDuty);
                             }
                     )
                    .Read(read => read.Action("CustomersContactsRead", "Customers", new { customerID = "#=CustomerID#" }))
                    .Update(update => update.Action("CustomersContactsEdit", "Customers"))
                    .Create(update => update.Action("CustomersContactsCreate", "Customers", new { customerID = "#=CustomerID#" }))
                    )
                    .Events(e => e.Edit("onEdit"))
                    .Pageable()
                    .Sortable()
                    .Editable(editing => editing.Mode(GridEditMode.InCell))
                    .ToolBar(toolbar =>
                    {
                        toolbar.Create();
                        toolbar.Save();
                    })
                    .ToClientTemplate())



                                           );}))

是否有大括号代码检查程序?你能发现任何错误吗?

提前Thanx!

1 个答案:

答案 0 :(得分:1)

问题在于这一行

Content(obj => @(Html.Kendo().Grid<ModelApp.Models.CustomerContacts>()

在剃刀中你应该使用template delegates

Content(@<text>
    @(Html.Kendo().Grid<ModelApp.Models.CustomerContacts>()