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

4 posts, 0 answers
  1. Jason
    Jason  avatar
    1 posts
    Member since:
    Aug 2012

    Posted 31 Jan 2013 Link to this post

    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.
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 04 Feb 2013 Link to this post

    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!
  3. Jason
    Jason  avatar
    1 posts
    Member since:
    Aug 2012

    Posted 07 Feb 2013 Link to this post

    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!
  4. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 11 Feb 2013 Link to this post

    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!
Back to Top