Kendo ui 未捕获错误:模板Kendu Dropdownlist无效 @**@ @(Html.Kendo().DropDownList()) .名称(“属性代码”) .DataTextField(“属性代码”) .DataValueField(“AttributeCodeId”) .DataSource(source=> { source.Read(Read=> { read.Action(“AttributeSecurityCode_read”,“AttributeCode”) .数据(“过滤代码”); }) .ServerFiltering(true); }) .Enable(false) .AutoBind(假) .CascadeFrom(“属性名称”) ) 函数filterCode(){ 返回{ AttributeName:$(“#AttributeName”).val() }; }

Kendo ui 未捕获错误:模板Kendu Dropdownlist无效 @**@ @(Html.Kendo().DropDownList()) .名称(“属性代码”) .DataTextField(“属性代码”) .DataValueField(“AttributeCodeId”) .DataSource(source=> { source.Read(Read=> { read.Action(“AttributeSecurityCode_read”,“AttributeCode”) .数据(“过滤代码”); }) .ServerFiltering(true); }) .Enable(false) .AutoBind(假) .CascadeFrom(“属性名称”) ) 函数filterCode(){ 返回{ AttributeName:$(“#AttributeName”).val() }; },kendo-ui,kendo-asp.net-mvc,Kendo Ui,Kendo Asp.net Mvc,我的代码有什么问题?它给了我这个错误 kendo.all.js:198未捕获错误:无效模板:'attributetype*kendo.syncReady(function(){jQuery(#AttributeName”).kendoDropDownList({“dataTextField”:“AttributeTypeName”、“dataValueField”:“AttributeTypeId”、“dataSource”:{“transport”:{“read”:{“url”:“/Attri

我的代码有什么问题?它给了我这个错误


kendo.all.js:198未捕获错误:无效模板:'attributetype*kendo.syncReady(function(){jQuery(#AttributeName”).kendoDropDownList({“dataTextField”:“AttributeTypeName”、“dataValueField”:“AttributeTypeId”、“dataSource”:{“transport”:{“read”:{“url”:“/AttributeType/AttributeTypesSecurity_Read”},“前缀”:“}”,模式:{“错误”:“错误”}}}});});

如果在模板中,请尝试使用延迟脚本:

                @*<select id="attr-code-dropdown" class="ms-TextField-field detail-input"></select>*@
                @(Html.Kendo().DropDownList()
                  .Name("AttributeCode")
                  .DataTextField("AttributeCode")
                  .DataValueField("AttributeCodeId")
                  .DataSource(source =>
                  {
                      source.Read(read =>
                      {
                          read.Action("AttributeSecurityCode_Read", "AttributeCode")
                          .Data("filterCode");
                      })
                      .ServerFiltering(true);
                  })
                .Enable(false)
                .AutoBind(false)
                .CascadeFrom("AttributeName")
                )
                <script>
                    function filterCode() {
                    return {
                        AttributeName: $("#AttributeName").val()
                        };
                    }
                </script>
@(Html.Kendo().DropDownList())
.名称(“属性代码”)
.DataTextField(“属性代码”)
.DataValueField(“AttributeCodeId”)
.DataSource(source=>
{
source.Read(Read=>
{
read.Action(“AttributeSecurityCode_read”,“AttributeCode”)
.数据(“过滤代码”);
})
.ServerFiltering(true);
})
.Enable(false)
.AutoBind(假)
.CascadeFrom(“属性名称”)
.Deferred()//告诉剑道执行下面的脚本
)
函数filterCode(){
返回{
AttributeName:$(“#AttributeName”).val()
};
}
@Html.Kendo().DeferredScripts()

抱歉,Steve,但这不起作用。它仍然给了我相同的错误。您的读取方法正在以所需格式返回数据?这是在剑道模板内还是只是表单的一部分?
@(Html.Kendo().DropDownList()
  .Name("AttributeCode")
  .DataTextField("AttributeCode")
  .DataValueField("AttributeCodeId")
  .DataSource(source =>
  {
      source.Read(read =>
      {
          read.Action("AttributeSecurityCode_Read", "AttributeCode")
          .Data("filterCode");
      })
      .ServerFiltering(true);
  })
  .Enable(false)
  .AutoBind(false)
  .CascadeFrom("AttributeName")
  .Deferred()  // tell kendo to do scripts below
)

<script>

    function filterCode() {
      return {
        AttributeName: $("#AttributeName").val()
      };
    }

    @Html.Kendo().DeferredScripts()

</script>