Tom Black
Tom Black

Reputation: 1

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

I am new to Kendo and trying to work through the Ajax Editing with Kendo UI Grid - http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/ajax-editing

I am trying to add the Kendo Grid to my view. Here is the code block I am using in my view:

@(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()
)

When I compile and run, I get the following error:

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

I would greatly appreciate any ideas as to how to resolve this error message.

Upvotes: 0

Views: 731

Answers (1)

Petur Subev
Petur Subev

Reputation: 20193

Clearly you do not have such namespace in your solution. Change that namespace according to your project.

@(Html.Kendo().Grid<YourAjaxBindingDemo.Models.RoleViewModel()

Upvotes: 1

Related Questions