Asp.Net MVC Grid Custom type with web api is not working.

3 posts, 0 answers
  1. Suman
    Suman avatar
    11 posts
    Member since:
    Mar 2017

    Posted 23 Mar Link to this post

    Hi,

    I am working on Asp.Net MVC Grid (MVC 5 2017.1.223)  Please see the below code details.

    @(Html.Kendo().Grid<EditableTest>()
            .Name("Grid")
            .Columns(columns =>
            {
                columns.Bound(c => c.testID).Hidden();
                columns.Bound(c => c.testDesc).Title("City Description");
                columns.Bound(c => c.testCode).Title("Country");
                columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
            })
            .ToolBar(toolbar => { toolbar.Create(); })
            .Editable(ed => ed.Mode(GridEditMode.PopUp))
            .Sortable()
            .Pageable(pageable => pageable
                .Refresh(true)
                .PageSizes(true)
                .ButtonCount(5))
            .Filterable()
            .DataSource(dataSource => dataSource
                .Custom()
                .PageSize(20)
                .Schema(schema => schema.Model(m => m.Id(p => p.testID)))
                .Transport(transport =>
                {
                    transport.Read(read => read.Url("http://localhost:60018/api/testapi").DataType("json"));
                    transport.Create(create => create.Url("http://localhost:60018/api/testapi").Type(HttpVerbs.Post).DataType("json"));
                    transport.Update(Update => Update.Url("http://localhost:60018/api/testapi").Type(HttpVerbs.Put).DataType("json"));
                    transport.Destroy(del => del.Url("http://localhost:60018/api/testapi").Type(HttpVerbs.Delete).DataType("json"));                
                })
            )
    )

     

    This is custom Grid with web api. Read and create is work fine but update and destroy is not working. Is there any missing code. I understand for Put and Delete need to pass parameter thru web Api. I think I already added scheme for ID.  Appreciate your help on this. :)

     

    Regards
    Suman G

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2115 posts

    Posted 27 Mar Link to this post

    Hi Suman,

    You need to pass the identifying field to the Update and Delete as shown in the following help article:
    Please try to use the HttpRouteUrl for the URL of the Update and Delete and see if the issue will be resolved.


    Regards,
    Konstantin Dikov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Suman
    Suman avatar
    11 posts
    Member since:
    Mar 2017

    Posted 17 Jul in reply to Konstantin Dikov Link to this post

    Thanks it working fine.
Back to Top