Reputation: 728
I have KendoUI grid implementation as shown below, it pulls and displays the data into the grid, but on create or update it is not working because it always makes Get request to the server,
the controller method marked as post for create and update - [AcceptVerbs(HttpVerbs.Post)] is there any where we can specify the Http method from client code?
also there is a same issue with sorting as well, the sample demo app that Kendo UI shows all makes Post method, but this one makes get, so it does not pass the sorting related objects to controller method properly
@(Html.Kendo().Grid<Model.Storage>()
.Name("Grid")
.Columns(columns => {
columns.Bound(p => p.Id);
columns.Bound(p => p.Name);
columns.Bound(p => p.Path);
columns.Bound(p => p.Default);
columns.Command(command => { command.Edit(); });
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Sortable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.Id))
.Create(update => update.Action("EditingInline_Create", "Storage"))
.Read(read => read.Action("EditingInline_Read", "Storage"))
.Update(update => update.Action("EditingInline_Update", "Storage"))
)
)
Help on this would be really appreciated.. !
Upvotes: 1
Views: 5662
Reputation: 2582
Yes, you can specify the HttpMethod from the client code. Change your DataSource methods to look like this:
.Create(update => update.Action("EditingInline_Create", "Storage").Type(HttpVerbs.Post))
.Read(read => read.Action("EditingInline_Read", "Storage").Type(HttpVerbs.Post))
.Update(update => update.Action("EditingInline_Update", "Storage").Type(HttpVerbs.Post))
HTH!
Upvotes: 2
Reputation: 16928
Make sure you're not using jQuery 1.8, I had a similar problem with their controls and it turned out to be a compatibility problem with 1.8.
Upvotes: 1
Reputation: 30661
Check the troubleshooting help topic: http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/troubleshooting
You have not included kendo.aspnetmvc.min.js.
Upvotes: 2