Jquery 如何使用Telerik组合框的选定值过滤MVC Telerik网格?

Jquery 如何使用Telerik组合框的选定值过滤MVC Telerik网格?,jquery,asp.net-mvc-3,telerik,telerik-mvc,Jquery,Asp.net Mvc 3,Telerik,Telerik Mvc,我有一个ASP.NETMVC3pageRazor,它由一个Telerik组合框和一个Telerik网格组成。我不知道如何使用jquery从组合框中获取值,然后使用该值过滤或重新绑定网格数据 我的Telerik组合框中加载了*category\u id*、*category\u name*,我对其进行了编码,以便在我键入category\u name时,它会自动过滤,直到找到一个完美匹配项或选择一个项目 关于实现这一点的最佳方法有什么指导,或者关于使jquery更容易智能化的提示吗?将不胜感激 下

我有一个ASP.NETMVC3pageRazor,它由一个Telerik组合框和一个Telerik网格组成。我不知道如何使用jquery从组合框中获取值,然后使用该值过滤或重新绑定网格数据

我的Telerik组合框中加载了*category\u id*、*category\u name*,我对其进行了编码,以便在我键入category\u name时,它会自动过滤,直到找到一个完美匹配项或选择一个项目

关于实现这一点的最佳方法有什么指导,或者关于使jquery更容易智能化的提示吗?将不胜感激

下面是jquery代码中导致错误的一个代码部分,页面将不会加载任何数据。firebug的错误消息是:$Customers.datatComboBox未定义,但我正按照Telerik网站上的描述进行操作,当我查看页面源代码时,我看到了以下内容:

 jQuery('#Categories').tComboBox...snipped the  rest
以下是我失败的函数:

 function dataBinding(args) {
   var categoryName = $("#Customers").data("tComboBox").value();
   args.data = $.extend(args.data, { categoryName: categoryName });
}

您可以为jQuery添加intellisense,请阅读本文了解如何做到这一点:

要从Telerik组合框中检索所选值,请执行以下操作:

查看标记

为了进一步澄清,在$DropDownList.datatDropDownList.text中,DropDownList是在助手方法Html.Telerik.DropDownList.NameDropDownList中分配给控件的名称,因此您应该将上面发布的代码更改为$Customers.datatCustomers.value,它应该可以工作


PS:关于Telerik ASP.NET MVC ComboBox API的更多信息可以在

上找到,可能更好地发布在Telerik论坛上,因为这似乎非常特定于Telerik API。其中是从中调用的上述数据绑定方法。您确定组合框在此点已初始化吗?
// Assumed defenition of the combobox
<%= Html.Telerik().DropDownList()
        .Name("DropDownList")
        .BindTo(new SelectList(Model, "ProductID", "ProductName"))
        .HtmlAttributes(new { style = "width: 200px; float: left; clear:both; margin-bottom: 230px;" })
%>
// Will Get Selected Text
$("#DropDownList").data("tDropDownList").text()
// Will Get Selected Value
$("#DropDownList").data("tDropDownList").value()