Client side binding with WCF

6 posts, 0 answers
  1. Dewang Shah
    Dewang Shah avatar
    16 posts
    Member since:
    Jan 2010

    Posted 22 Oct 2010 Link to this post

    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
  2. Dewang Shah
    Dewang Shah avatar
    16 posts
    Member since:
    Jan 2010

    Posted 22 Oct 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dewang Shah
    Dewang Shah avatar
    16 posts
    Member since:
    Jan 2010

    Posted 22 Oct 2010 Link to this post

    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?
  5. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 26 Oct 2010 Link to this post

    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
  6. Henrique Duarte
    Henrique Duarte avatar
    104 posts
    Member since:
    Oct 2003

    Posted 30 Dec 2010 Link to this post

    Guys,

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

    Best regards,

    Henrique

  7. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 30 Dec 2010 Link to this post

    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 
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017