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

grid wont display data using asp.net web api

1 Answer 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ashish
Top achievements
Rank 1
Ashish asked on 01 Jul 2012, 06:18 AM
Hello,
I am pretty new to kendo ui and i am trying to get a simple example to work. I have created a REST based web service using asp.net web api which returns IQueryable<> ( so supposedly it supports odata). I can verify that it returns data using a browser.

I have another page in the same application that has a kendo grid in which i am trying to display data returned from the service, the code is 

<div id="body">
    <div id="grid"/>
        @Scripts.Render("~/bundles/jquery")
        <script src="../Scripts/Kendo/kendo.all.min.js" type="text/javascript"></script>
         <script src="../Scripts/Kendo/kendo.web.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#grid").kendoGrid(
        {
            dataSource:
            {
                type: "odata",
                transport:
                {
                    read: "http://localhost/MSDNWebApi/Api/Movie"
                }
            }
        })
            });  
        </script>
 </div>   
I can confirm using chrome's development tools that the there are no errors and all the requests from the server are working. I can also confirm that the service is returning json data when the kendo ui makes the call, however the ui does not display any data..

I read somewhere that it needs a jsonp format, but i am hoping that its only needed for cross domain conversation.
any help will be appreciated.
Attached the output from the service....
thanks



1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 04 Jul 2012, 12:49 PM
Hello Ashish,

I believe the problem is caused by the type: "odata" configuration of the dataSource - it sets up a transport with preconfigured settings that should be used only if the service is working with odata protocol.
I commented out this property and data loaded as expected, if you wish you can check the result here:
I hope this helps.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Ashish
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or