Trying to get Grid to work using WebAPI

5 posts, 1 answers
  1. Toffer
    Toffer avatar
    34 posts
    Member since:
    Sep 2015

    Posted 02 Oct 2015 Link to this post

    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())

  2. Toffer
    Toffer avatar
    34 posts
    Member since:
    Sep 2015

    Posted 05 Oct 2015 in reply to Toffer Link to this post

    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.  :)
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Answer
    Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 06 Oct 2015 Link to this post

    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
  5. Toffer
    Toffer avatar
    34 posts
    Member since:
    Sep 2015

    Posted 06 Oct 2015 in reply to Kiril Nikolov Link to this post

    Thanks for the response, I'll give this a try.  :)
  6. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 08 Oct 2015 Link to this post

    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready