0

我是 Kendo 新手,正在尝试使用 Kendo UI Grid 进行 Ajax 编辑 - http: //docs.kendoui.c​​om/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/ajax-editing

我正在尝试将剑道网格添加到我的视图中。这是我在视图中使用的代码块:

@(Html.Kendo().Grid<KendoGridAjaxBinding.Models.RoleViewModel()
    .Name("grid")
    .Columns(columns =>
        {
            columns.Bound(role => role.RoleID).Width(100);
            columns.Bound(role => role.RoleName);
            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(role => role.RoleID); // Specify the property which is the unique identifier of the model
                model.Field(role => role.RoleName).Editable(false); // Make the ProductID property not editable
            })
            .Create(create => create.Action("Role_Create", "Home")) // Action invoked when the user saves a new data item
            .Read(read => read.Action("Role_Read", "Home"))  // Action invoked when the grid needs data
            .Update(update => update.Action("Role_Update", "Home"))  // Action invoked when the user saves an updated data item
            .Destroy(destroy => destroy.Action("Role_Destroy", "Home")) // Action invoked when the user removes a data item
        )
        .Pageable()
)

当我编译并运行时,我收到以下错误:

Compiler Error Message: CS0103: The name 'KendoGridAjaxBinding' does not exist in the current context

我将不胜感激有关如何解决此错误消息的任何想法。

4

1 回答 1

1

显然,您的解决方案中没有这样的命名空间。根据您的项目更改该命名空间。

@(Html.Kendo().Grid<YourAjaxBindingDemo.Models.RoleViewModel()
于 2013-10-29T16:55:36.680 回答