【发布时间】:2014-08-20 05:14:48
【问题描述】:
我一直在我的asp.net MVC4项目中使用Kendo UI,它工作正常。
我用过DropDownList, Grid,之类的小部件,没问题。
最近我想将我的一些DropDownList 更改为MultiSelect,
所以我尝试复制此链接中的示例:MultiSelect Basic Usage
但是,会显示一条错误消息:
CS1061: 'Kendo.Mvc.UI.Fluent.WidgetFactory<XXX>' does not contain a definition for 'MultiSelect' and no extension method 'MultiSelect' accepting a first argument of type 'Kendo.Mvc.UI.Fluent.WidgetFactory<XXX>' could be found (are you missing a using directive or an assembly reference?)XXX 是传入该视图的模型。
我在谷歌上搜索了一下,似乎是关于命名空间/引用配置的问题,但正如我所说,我已经正常使用了其他 Kendo UI 小部件...
下面是我的 WORKING DropDownList 的代码,以及一个不工作的 MultiSelect
@(Html.Kendo().DropDownList()
.Name("vendorName") // Name of the widget should be the same as the name of the property
.DataValueField("VendorCategoryID") // The value of the dropdown is taken from the EmployeeID property
.DataTextField("VendorName") // The text of the items is taken from the EmployeeName property
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetVendors", "GenReport"); //Set the Action and Controller name
});
})
.OptionLabel("---Please Select---")
.Events(e =>
{
e.Change("vendorOnChange");
})
)
@(Html.Kendo().MultiSelect()
.Name("required")
.Placeholder("Select attendees...")
.BindTo(new List<string>() {
"Steven White",
"Nancy King",
"Anne King",
"Nancy Davolio",
"Robert Davolio",
"Michael Leverling",
"Andrew Callahan",
"Michael Suyama",
"Anne King",
"Laura Peacock",
"Robert Fuller",
"Janet White",
"Nancy Leverling",
"Robert Buchanan",
"Andrew Fuller",
"Anne Davolio",
"Andrew Suyama",
"Nige Buchanan",
"Laura Fuller"
})
.Value(new string[] { "Anne King", "Andrew Fuller" })
)
这是我的 VS2012 的 Intellisense,没有 MultiSelect...
谁能帮助我并告诉我如何使用MultiSelect?谢谢!
【问题讨论】:
-
您使用的是哪个版本的剑道 UI?
-
我找不到安装程序...但是包含 Kendo UI 的文件夹名为“Kendo UI for ASP.NET MVC Q3 2012”,我正在使用“Kendo UI”的 dll for ASP.NET MVC Q3 2012/wrappers/aspnetmvc/Binaries/Mvc3/Kendo.Mvc.dll”这听起来像是剑道UI版本问题吗?如果是,我可以告诉我的老板,然后我可以使用其他解决方法来解决它...谢谢!
-
多选是在 2013 年第一季度发布的 Kendo 中添加的。 telerik.com/support/whats-new/kendo-ui-web/release-history 适用于所有主要版本。如果您仍然有有效的 Telerik 订阅,请从帐户页面或 Telerik 启动器安装。
-
谢谢..它实际上节省了我的一天!
-
@DavidShorthose 将其添加为答案。 :)
标签: asp.net-mvc-4 razor kendo-ui multi-select kendo-asp.net-mvc