11.8. Binding to External Services

Of course, when you are binding to data, you usually want to retrieve it from an external source. The DataView control allows you to easily accomplish this and bind to many different types of services, for example:

  • ASMX web service

  • WCF web services

  • WCF Data Services

  • ASP.NET MVC controller actions

  • JSONP service

  • Basically anything that returns JSON-formatted data

You will now use client templates to bind to ASMX and WCF web services.

11.8.1. Binding to a Web Service (.asmx)

First bind to the web service:

  1. Add a new class called Person to the project, and enter the following class definition:

    public class Person
    {
       public string Name { get; set; }
       public string Age { get; set; }
    }
  2. Add a new .asmx web service to the project ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.