How do I bind a table/grid to list items received from a Web service?

Problem Statement

You are required to present your users with a tabular listing, each line describing a business record (i.e., sales contact) with aligned columns for each field (i.e., name, title, company, phone number), and the application information you want to present has been exposed as a Web service.  You may be choosing this architecture because it insulates your application from changes in the underlying database (a Façade pattern), or it provides data to consumers implemented on different platforms (an Adapter pattern).

Infragistics Solutions

ASP.NET     Windows Forms    
 

Add a Web reference to create the proxy object you'll use to call the Web service and the .NET objects that correspond to members of the Web service's data contract.  Use the Quick Design features of the WebGrid to edit the data structure of the table you want users to see by adding columns and headers.

After calling the Web service, you'll need to map the values in the .NET objects deserialized from the response into new Rows that you'll add to an unbound WebGrid.  If you need to dispatch another Web service request following add, update, or delete operations by the user then you can do the reverse mapping on modified rows by handling the AddRow, UpdateRow, or DeleteRow events.

Other Solutions in the Data Binding Category

More Scenario Solutions...