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

Trying to get Grid to work using WebAPI

4 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Toffer
Top achievements
Rank 2
Toffer asked on 02 Oct 2015, 04:42 PM

Hello,

 I've been struggling to get my grid to work with an Web API...I know the WebAPI works when I call it via web browser, I get a properly formatted json response, however I can't seem to get it to work when calling it with the datasource for the grid.  I've tried using .Ajax() and .WebApi() and neither seems to work.

I also created a Action in my controller that returns the same information as the WebAPI just to see if I could get it to work using the Controller / Action and it worked just fine there, but I really wanted to use the Web API.  Here's the code I'm trying to use...can anyone see anything obviously wrong?

 

@(Html.Kendo().Grid<DefectFeature>()
        .Columns(column =>
        {
            column.Bound(df => df.Name)
                .Title("Name");
            column.Bound(df => df.LastUpdate)
                .Title("Last Update");
        })
        .DataSource(dataSource => dataSource
            .WebApi()
            .Read(read => read.Url("http://cmd-roswell.redmond.corp.microsoft.com/api/DataMaintenance/GetDefectFeatures").Type(HttpVerbs.Get)))
        .HtmlAttributes(new { style = "height:300px;" })
        .Name("LKGBuildsGrid")
        .Scrollable()
        .Selectable()
        .Sortable())

4 Answers, 1 is accepted

Sort by
0
Toffer
Top achievements
Rank 2
answered on 05 Oct 2015, 03:49 PM
Since I haven't been able to figure out what to do here, I have created controller actions that replicate what the Web APIs do so I can unblock myself and move forward with designing the web app, however I would really love to forget using the controller actions and just use all Web APIs.  If anyone knows how to solve this or can help me troubleshoot my way though figuring out what's wrong, that would be great.  :)
0
Accepted
Kiril Nikolov
Telerik team
answered on 06 Oct 2015, 09:00 AM

Hello Toffer,

 

An example of Kendo UI Grid with full CRUD operations and WebAPI is available here:

https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/webapi-crud

 

Please check it out and let me know if it helps.

 

Regards,
Kiril Nikolov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Toffer
Top achievements
Rank 2
answered on 06 Oct 2015, 03:50 PM
Thanks for the response, I'll give this a try.  :)
0
Kiril Nikolov
Telerik team
answered on 08 Oct 2015, 07:37 AM

Hello Toffer,

 

In case you have any further questions, please do not hesitate to contact us.

 

Regards,
Kiril Nikolov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Toffer
Top achievements
Rank 2
Answers by
Toffer
Top achievements
Rank 2
Kiril Nikolov
Telerik team
Share this question
or