
I successfully created a dataService with EF4 and OData enable
my uri is http://myserver/sa2.Web/sa2-Web-DomainService1.svc/OData/UserSet
And i successfully see the data using the OdataExplorer
http://www.odata.org/developers/odata-sdk
But when I try to retrieve the data to kendoGrid i obtain an error
<script type="text/javascript">
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
transport: {
read: "http://myserver/sa2.Web/sa2-Web-DomainService1.svc/OData/UserSet"
}
},
columns: ["Id", "name"]
});
});
</script>
The table name is User with 2 columns Id and name
Could you help ?????
Thanks
Fred
This XML file does not appear to have any style information associated with it. The document tree is shown below.
7 Answers, 1 is accepted
We are not sure what is causing this problem. However the service should return results when the URL is requested by pasting it in the browser address bar. Probably this is caused by some OData configuration issue.
All the best,Atanas Korchev
the Telerik team

i obtain also this error
any idea what to do ?
XMLHttpRequest cannot load http://myserver/sa2.Web/sa2-Web-DomainService1.svc/OData/UserSet. Origin http://localhost:49424 is not allowed by Access-Control-Allow-Origin.
in the browser
http://myserver/sa2.Web/sa2-Web-DomainService1.svc/OData/UserSet
returns
<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> <feed xml:base="http://myserver/sa2.Web/Services/sa2-Web-DomainService1.svc/OData/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"> <title type="text">UserSet</title> <id>http://myserver/sa2.Web/Services/sa2-Web-DomainService1.svc/OData/UserSet</id> <updated>2011-12-29T11:48:10Z</updated> <link rel="self" title="UserSet" href="UserSet" /> <entry> <id>http://myserver/sa2.Web/Services/sa2-Web-DomainService1.svc/OData/UserSet(1)</id> <title type="text"></title> <updated>2011-12-29T11:48:10Z</updated> <author> <name /> </author> <link rel="edit" title="User" href="UserSet(1)" /> <category term="sa2.Web.User" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:Id m:type="Edm.Int32">1</d:Id> <d:name>fred</d:name> </m:properties> </content> </entry> <entry> <id>http://myserver/sa2.Web/Services/sa2-Web-DomainService1.svc/OData/UserSet(2)</id> <title type="text"></title> <updated>2011-12-29T11:48:10Z</updated> <author> <name /> </author> <link rel="edit" title="User" href="UserSet(2)" /> <category term="sa2.Web.User" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:Id m:type="Edm.Int32">2</d:Id> <d:name>toto</d:name> </m:properties> </content> </entry> </feed>
When do you receive this error? Such an error will occur if you are trying to request the service using $.ajax because cross domain ajax requests are not allowed by the browsers. However if you are using an odata DataSource this problem should not be present.
Something strange is going on. Could you paste the declaration of your OData service?
Atanas Korchev
the Telerik team

Hi
<
add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, system.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
"NetworkError: 401 Unauthorized - http://fhayounw7/sa2.Web/sa2-Web-DomainService1.svc/OData/UserSet"
I obtain now this error
could you help ?
Thanks
Fred
We are not sure what may cause this error as it seems to be generated server side. Most probably this is not related to Kendo but is caused by some configuration setting.
I suggest you try looking for a solution online. For example searching for "NetworkError: 401 OData" returns a few results which may be helpful.
Atanas Korchev
the Telerik team

Hi
I successfully implement an ajax application using json.
i try now to use gridKendo, but the grid is emply
my script is as following
<script type="text/javascript">
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
url: "data.json",
type: "json",
transport: {
read: "http://localhost:53814/sa3-Web-DomainService1.svc/JSON/GetUsers"
}
},
columns: ["Id", "name"]
});
});
</script>
What is missing, since I obtain any error in firebug
GET http://localhost:53814/sa3-Web-DomainService1.svc/JSON/GetUsers
200 OK
GetUsersResult
Object { TotalCount=2, RootResults=[2]}
TotalCount
2
RootResults
[Object { Id=1, name="fred"}, Object { Id=2, name="toto"}]
0
Object { Id=1, name="fred"}
1
Object { Id=2, name="toto"}
{"GetUsersResult":{"TotalCount":2,"RootResults":[{"Id":1,"name":"fred"},{"Id":2,"name":"toto"}]}}
Could you please specify how the result JSON looks like? Is it like this:
{"GetUsersResult":{"TotalCount":2,"RootResults":[{"Id":1,"name":"fred"},{"Id":2,"name":"toto"}]}}
If yes then you need to configure your DataSource to read the data from "GetUsersResult.RootResults":
dataSource: {
schema: {
data: "GetUsersResult.RootResults"
},
transport: {
read: "http://localhost:53814/sa3-Web-DomainService1.svc/JSON/GetUsers"
}
}
Atanas Korchev
the Telerik team