Asp.net mvc Telerik Kendo MVC级联组合框问题

Asp.net mvc Telerik Kendo MVC级联组合框问题,asp.net-mvc,combobox,telerik,kendo-ui,Asp.net Mvc,Combobox,Telerik,Kendo Ui,我的Telerik Kendo MVC UI代码有问题。我的代码看起来非常简单,但当我在组合框上放置“.CascadeFrom”属性时,它会停止正确加载。这似乎与以下事实有关:当我插入javascript函数的定义时,它似乎没有注册。我在网上得到了以下信息 web开发人员控制台: [08:19:25.006] ReferenceError: getCountyVal is not defined in /Employer/Details/1 我认为我已经将问题隔离到使用.CascadeFrom

我的Telerik Kendo MVC UI代码有问题。我的代码看起来非常简单,但当我在组合框上放置“.CascadeFrom”属性时,它会停止正确加载。这似乎与以下事实有关:当我插入javascript函数的定义时,它似乎没有注册。我在网上得到了以下信息

web开发人员控制台:

[08:19:25.006] ReferenceError: getCountyVal is not defined in /Employer/Details/1
我认为我已经将问题隔离到使用.CascadeFrom属性或javascript函数的情况;当我不需要javascript调用或JSON返回服务器端代码中的输入变量时,我肯定能够加载

前端代码: (2个组合框,.cshtml文件中的部分视图)


请将下面的代码片段放在其他代码/标记的开头

JS

 <script type="text/javascript">
        function getCountyVal() {
            return {
                CountySel: $("#countyselector").data("kendoComboBox").input.val()
            };
        }
    </script>

函数getCountyVal(){
返回{
CountySel:$(“#countyselector”).data(“kendoComboBox”).input.val()
};
}


函数getCountyVal(){
返回{
CountySel:$(“#countyselector”).val()
};
}

这个问题很流行,我不知道相关的答案是否有效。如果这个答案解决了你的问题,请留下评论,这样我就可以接受了。
public JsonResult getCityAreas(int CountySel)
{
    // Return a set of CountyCityAreaTypeID's and their associated names based on a countyID.
    //return Json(db.vw_CountyCities.Where(x => x.CountyTypeId == Convert.ToInt16(CurrCountyValue))
    //            .Select(i => new { i.CountyCityAreatypeId, i.NameStr }), JsonRequestBehavior.AllowGet);
    var retval = Json(db.vw_CountyCities
                .Select(i => new { i.CountyCityAreatypeId, i.NameStr }), JsonRequestBehavior.AllowGet);
    return retval;
}

public JsonResult getCountyTypes()
{
    return Json(db.CountyTypes.Select(i => new { i.CountyTypeId, i.NameStr }), JsonRequestBehavior.AllowGet);
}
 <script type="text/javascript">
        function getCountyVal() {
            return {
                CountySel: $("#countyselector").data("kendoComboBox").input.val()
            };
        }
    </script>
    <script type="text/javascript">
         function getCountyVal() {
             return {
                 CountySel: $("#countyselector").val()
             };
         }
    </script>