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

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

2 Answers 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suman
Top achievements
Rank 1
Suman asked on 23 Mar 2017, 06:13 PM

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 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 27 Mar 2017, 02:08 PM
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.
0
Suman
Top achievements
Rank 1
answered on 17 Jul 2017, 10:11 AM
Thanks it working fine.
Tags
Grid
Asked by
Suman
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Suman
Top achievements
Rank 1
Share this question
or