嗨,我在我的 MVC 项目中使用 KEndo Ajax Grid。我在我的网格中使用 htmlhlper 来简单地进入新页面,但我收到错误“mvc.HTMLHelper 不包含 ActionLink 的定义和最佳扩展方法重载”
我的代码
<%: Html.Kendo().Grid<KendoGridAjaxEditing2.Models.ProductViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(product => product.CustomerID).Width(100);
columns.Bound(product => product.CustomerName).Template(c => @Html.ActionLink(c.CustomerID, "ViewDetails", new { id = c.CustomerID }));
columns.Bound(product => product.CustomerLastName).Width(250);
columns.Bound(product => product.Customerage).Width(250);
columns.Command(commands =>
{
commands.Edit(); // The "edit" command will edit and update data items
commands.Destroy(); // The "destroy" command removes data items
}).Title("Commands").Width(200);
})
.ToolBar(toolbar => toolbar.Create()) // The "create" command adds new data items
.Editable(editable => editable.Mode(GridEditMode.InLine)) // Use inline editing mode
.DataSource(dataSource =>
dataSource.Ajax()
.Model(model =>
{
model.Id(product => product.CustomerID); // Specify the property which is the unique identifier of the model
model.Field(product => product.CustomerID).Editable(false); // Make the ProductID property not editable
})
.Create(create => create.Action("Products_Create", "Home")) // Action invoked when the user saves a new data item
.Read(read => read.Action("Products_Read", "Home")) // Action invoked when the grid needs data
.Update(update => update.Action("Products_Update", "Home")) // Action invoked when the user saves an updated data item
.Destroy(destroy => destroy.Action("Products_Destroy", "Home")) // Action invoked when the user removes a data item
)
.Pageable()
%>
需要帮助 谢谢