This is a migrated thread and some comments may be shown as answers.

ClientDetailTemplateId - Have Read, Insert working, but Update, Delete don't pass Ids

3 Answers 178 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 31 Jan 2013, 03:52 PM
I have a parent/child grid which correctly displays the child table and is working for both Read & Create. However, Update and Delete don't pass the Id in the URL as I can see from the console.
.DataSource(dataSource => dataSource
                .Ajax()
                 .Model(model =>
            {
                model.Id(g => g.id);
                model.Field(g => g.id).Editable(false);
                model.Field(g => g.user_id);
                model.Field(g => g.group_id);
            })
                .Read(read => read.Url("http://localhost:808/api/UserGroup/" + "#=id#").Type(HttpVerbs.Get))
                .Create(c => c.Url("http://localhost:808/api/UserGroup").Type(HttpVerbs.Post))
                .Update(update => update.Url("http://localhost:808/api/UserGroup").Type(HttpVerbs.Put))
                .Destroy(destroy => destroy.Url("http://localhost:808/api/UserGroup").Type(HttpVerbs.Delete))
            )
This is what I see in the console:
OPTIONS http://localhost:808/api/UserGroup 405 (Method Not Allowed) jquery.min.js:2
OPTIONS http://localhost:808/api/UserGroup 405 (Method Not Allowed) jquery.min.js:2
DELETE http://localhost:808/api/UserGroup 404 (Not Found) UserGroup:1
XHR finished loading: "http://localhost:808/api/UserGroup".
The DELETE should be passing the Id of the row.

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 04 Feb 2013, 09:47 AM
Hello Jason,

It sounds like you either need to implement CORS support like mentioned in this question on stackoverflow.

Or for some reason the ASP.NET MVC server does not allow you to reach the action method. Check out these questions and their resolutions.
http://stackoverflow.com/questions/12276316/mvc-4-iis-7-5-put-returning-405
http://stackoverflow.com/questions/5382868/jquery-asp-net-mvc-405-post-not-allowed

Kind Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jason
Top achievements
Rank 1
answered on 08 Feb 2013, 12:49 AM
Hi Petur,

That doesn't seem to be it either. I have both added the CORS handler to global.asax and moved both sites to the same domain, now I get a 404 error; it still isn't passing the proper key id. Can you provide a sample w/api calls with children edit and deletes using the url syntax?
Thanks!
0
Petur Subev
Telerik team
answered on 11 Feb 2013, 02:29 PM
Hello Jason,

Basically we do not have just the same example but you can use the demo with a Grid which is bound to a Web Api Controller in our code library:

http://www.kendoui.com/code-library/mvc/grid/binding-to-a-web-apicontroller.aspx

Feel free to modify the project and send it back so we can take a look.

Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Jason
Top achievements
Rank 1
Share this question
or