Telerik MVC With Kendo accessing Web API

2 posts, 0 answers
  1. Jason
    Jason avatar
    3 posts
    Member since:
    Feb 2013

    Posted 24 Oct 2014 Link to this post

    I have seen some examples of using server side Kendo extensions to access Web API calls in the same project.  But what about if the Web API is a different project and URL?  We are doing this as an N-Tier where the Web API is the data access for multiple client applications.  Do you have a same using the server side KendoGrid to access a Web API call that is located on a different server/URL?  I can't figure this out.

    Here is what I have tried.  Both projects have a reference to the data classes so I hope to send a known type back and forth.  But this doesn't work:

    @(Html.Kendo().Grid<CustomerOrderModel>()
        .Name("Grid")    
            .Columns(columns =>
                         {
                             columns.Bound(o => o.OrderNumber);

                             columns.Bound(p => p.Description);

                             columns.Bound(p => p.Description2);

                             columns.Bound(p => p.Notes);

                         })
        .DataSource(dataSource => dataSource
            .WebApi()        
            .Read(read => read.Url("http://localhost:52559/api/CustomerOrder").Type(HttpVerbs.Get))

        )
    )
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 28 Oct 2014 Link to this post

    Hello Jason,

    If you are hosting the server on a different server then the requests are considered to be CORS:

    To see what needs to be done when it comes to enable CORS requests I would suggest you to check this topic:

    http://docs.telerik.com/kendo-ui/framework/datasource/cors

    Kind Regards,
    Petur Subev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top