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

Client side binding with WCF

5 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dewang Shah
Top achievements
Rank 1
Dewang Shah asked on 22 Oct 2010, 09:57 AM
I am trying to implement a similar solution to this example - http://demos.telerik.com/aspnet-ajax/grid/examples/client/livedata/defaultcs.aspx
However this example is with an ASMX service. I tried using exactly the same syntax with a WCF service but I just get a Javascript error saying "MyService" is not defined.

<script type="text/javascript">
 
     function pageLoad(sender, args) {
         setInterval("MyService.GetData(updateGrid)", 1000);
     }

I know I can statically data-bind to a WCF service but can I do that here? What am I missing?

Thanks

5 Answers, 1 is accepted

Sort by
0
Dewang Shah
Top achievements
Rank 1
answered on 22 Oct 2010, 10:43 AM
Dug a little deeper and found that the WCF service proxy object is created with the service namespace (such as tempuri.org). So I have updated my call in pageLoad and the service is getting called.

However, still no data displayed on the grid. I can step in to my service and see that it is returning the results but the grid is still blank.
0
Dewang Shah
Top achievements
Rank 1
answered on 22 Oct 2010, 04:26 PM
I seem to be getting there one very small and slow step at a time. The JSON did not like the date on my result for some reason. I have removed the date for now just to get things working. But when I make the call to update the grid
function updateGrid(result) {
    var tableView = $find("RadGrid1").get_masterTableView();
    tableView.set_dataSource(result.Data);
    tableView.dataBind();
}

I get a Javascript error that "this._dataSource is null" in the Telerik resourced script file that is trying to set the data source.

What am I missing now?
0
Nikolay Rusev
Telerik team
answered on 26 Oct 2010, 07:43 AM
Hello Dewang,

You can check whether result.Data actually returns data. I do not see any other reason for this behavior.

Best wishes,
Nikolay
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Henrique Duarte
Top achievements
Rank 1
Veteran
answered on 30 Dec 2010, 11:40 AM

Guys,

Don't you have any post or code sample showing how to access a WCF service hosted by another application?

Best regards,

Henrique

0
Prangadj
Top achievements
Rank 1
answered on 30 Dec 2010, 01:30 PM
Henrique, does using external OData WCF-type of feed count? If so, check the third grid on this online demo: http://demos.telerik.com/aspnet-ajax/grid/examples/clientbinding/defaultcs.aspx

Prangadj 
Tags
Grid
Asked by
Dewang Shah
Top achievements
Rank 1
Answers by
Dewang Shah
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Henrique Duarte
Top achievements
Rank 1
Veteran
Prangadj
Top achievements
Rank 1
Share this question
or