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

No Data from OData

3 Answers 172 Views
ODataDataSource
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 03 Jul 2012, 10:41 AM
I've got a WCF Data Service which is correctly publishing data (checked in the browser), yet when I hook it up to a RadTreeView or a RadMenu, nothing is rendered in the Browser...

My markup looks like this (generated by smart tags): 

<telerik:RadODataDataSource ID="RadODataSource1" runat="server">
  <Transport>
    <Read Url="http://localhost:8989/ODService.svc/" DataType="XML" />
  </Transport>
  <Schema>
    <telerik:DataModel ModelID="Thing" Set="Things">
      <telerik:DataModelField FieldName="Id" />
      <telerik:DataModelField FieldName="Name" />
      <telerik:DataModelField FieldName="Value" />
    </telerik:DataModel>
  </Schema>
</telerik:RadODataDataSource>
 
 
<telerik:RadTreeView ID="RadTreeView1" Runat="server" DataFieldID="Id" DataModelID="Thing" ODataDataSourceID="RadODataSource1"></telerik:RadTreeView>


The output in the browser when directed  to http://localhost:8989/ODService.svc/Things looks like this:

<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
  <title type="text">Things</title>
  <id>http://localhost:8989/ODService.svc/Things</id>
  <updated>2012-07-03T10:27:17Z</updated>
  <link rel="self" title="Things" href="Things" />
  <entry>
    <id>http://localhost:8989/ODService.svc/Things(0)</id>
    <title type="text"></title>
    <updated>2012-07-03T10:27:17Z</updated>
    <author>
      <name />
    </author>
    <link rel="edit" title="Thing" href="Things(0)" />
    <category term="RadApp.Data.Model.Thing" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <content type="application/xml">
      <m:properties>
        <d:Id m:type="Edm.Int32">0</d:Id>
        <d:Name>Thing0</d:Name>
        <d:Value>e55187e0-1439-4ac8-984b-504236caf274</d:Value>
      </m:properties>
    </content>
  </entry>
  <entry>
    <id>http://localhost:8989/ODService.svc/Things(1)</id>
    <title type="text"></title>
    <updated>2012-07-03T10:27:17Z</updated>
    <author>
      <name />
    </author>
    <link rel="edit" title="Thing" href="Things(1)" />
    <category term="RadApp.Data.Model.Thing" 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>Thing1</d:Name>
        <d:Value>cfb491c8-9a07-4393-a539-5d7078cc9ded</d:Value>
      </m:properties>
    </content>
  </entry>
  <entry>
    <id>http://localhost:8989/ODService.svc/Things(2)</id>
    <title type="text"></title>
    <updated>2012-07-03T10:27:17Z</updated>
    <author>
      <name />
    </author>
    <link rel="edit" title="Thing" href="Things(2)" />
    <category term="RadApp.Data.Model.Thing" 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>Thing2</d:Name>
        <d:Value>7daecdaa-4a69-4f61-87f6-55eaca455ccc</d:Value>
      </m:properties>
    </content>
  </entry>
</feed>

 
and finally, the source from the rendered web page where the control should be, looks like this:

<div id="RadTreeView1" class="RadTreeView RadTreeView_Clear">
    <input id="RadTreeView1_ClientState" name="RadTreeView1_ClientState" type="hidden" autocomplete="off" value="{"expandedNodes":[],"collapsedNodes":[],"logEntries":[],"selectedNodes":[],"checkedNodes":[],"scrollPosition":0}">
</div>


Is there something I'm doing wrong?

I can post up the code from the data classes or the context, but the fact that the service is outputting into the browser (as above) without problems, allowing me to correctly query it, would suggest that the problem isn't in the service itself.

3 Answers, 1 is accepted

Sort by
0
Dave
Top achievements
Rank 1
answered on 03 Jul 2012, 10:49 AM
Rad Controls for ASP.NET AJAX: v.2012.2.607.40
OS: Windows 7 Professional SP1 (x64)
Environment: Visual Studio 2010 (.Net 4.0)
Host: IIS 7.5.7600.16385 (also, same result in ASP.NET Development Server)
Tested with: Chrome 19.0.1084.56m & Firefox 13.0.1
0
Dave
Top achievements
Rank 1
answered on 03 Jul 2012, 01:26 PM
Update:

.../ODService.svc/Things?$callback=jQuery17203642104766331613_1341321397631&%24format=json&%24inlinecount=allpages

The query parameter '$callback' begins with a system-reserved '$' character but is not recognized. 

Which led me to this:
http://blogs.msdn.com/b/marcelolr/archive/2011/04/19/supporting-jsonp-callbacks-in-wcf-data-services.aspx 

Which led me to this:
http://archive.msdn.microsoft.com/DataServicesJSONP 

Which explains (and fixes) the issue, however these articles are more than a year out of date, and the solution means including creating a new class inside the service.

What is the Telerik recommended approach to remedy to this? Is there a better way?
0
Genady Sergeev
Telerik team
answered on 05 Jul 2012, 07:25 AM
Hi Dave,

Thank you for sharing this with us and the community. If you have encountered a bug in RadODataDataSource, which we are ought to fix for the upcoming service pack (scheduled for the end of July). There is nothing wrong in what you have done, it just that the ODataSource always passes the $format=json query string parameter to the service, and this parameter is not always supported. As a token of gratitude for pointing this problem to us I've updated your telerik points.


Kind regards,
Genady Sergeev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ODataDataSource
Asked by
Dave
Top achievements
Rank 1
Answers by
Dave
Top achievements
Rank 1
Genady Sergeev
Telerik team
Share this question
or