Intersoft Support Center

Bind to ADO.NET Data Service

This walkthrough shows you how to WebCombo to client-binding using AdoDataService mode.

During this walkthrough, you will learn how to do the following:

  • Create and use AdoDataService mode.
  • Configure WebCombo to client-binding using AdoDataService mode

 Prerequisites

In order to complete this walkthrough, you will need the following:

  • ADO.NET Entity Data Model.
  • Visual Studio 2008/2010 Application.

 Step-By-Step Instructions

To configure client binding using WebService mode

  1. Launch Visual Studio.NET 2010.
  2. Click on File menu, then select New and click Web Site.
  3. Select ASP.NET Web Site in the Template box.
  4. Named the Web Site and click OK.
  5. In the Solution Explorer, right-click on App_Data and select Add Existing Item.
  6. Browse and add NorthWind.mdf in C:\Program Files\Intersoft Solutions\Data (Default installation folder).
  7. In the Solution Explorer, right-click on App_Code and select Add New Item.
  8. Create a new ADO.NET Entity Data Model and named it NorthwindDataModel.edmx. Pick generate the model from database, choose Northwind.mdf as the data source and named the entity as NorthwindEntities.


  9. On the next screen, choose Customers to include in your database model. Click Finish.
  10. In the Solution Explorer, right-click on the WebProject and select Add New Item.
  11. Create a new WCF Data Service and named it NorthwindDataService.svc.
  12. Modify the NorthwindDataService.svc.cs to accept Customers and have full access.

    C# Copy Code
    using System;
    using System.Data.Services;
    using System.Collections.Generic;
    using System.Linq;
    using System.ServiceModel.Web;
    using NorthwindDataModel;
    
    [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    public class NorthwindDataService : DataService<NorthwindEntities>
    {
       // This method is called only once to initialize service-wide policies.
       public static void InitializeService(IDataServiceConfiguration config)
       {
          // TODO: set rules to indicate which entity sets and service 
          // operations are visible, updatable, etc.
          // Examples:
          
          config.SetEntitySetAccessRule("*", EntitySetRights.All);
          config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
          config.UseVerboseErrors = true;
       }
    }

  13. In the Solution Explorer, right-click on the project and select Add New Item.
  14. Select Web Form in the Templates box and named it as Walkthrough.aspx.
  15. Drag WebCombo instance from Toolbox to WebForm.
  16. Set the properties based on the table and code below.

    Property Value
    BindingOperationMode ClientBinding
    DataSourceType AdoDataService
    ServiceUrl NorthwindDataService.svc

    HTML Copy Code
    <ISWebCombo:WebCombo ID="wcCustomers" runat="server" Height="20px" UseDefaultStyle="True"
       Width="150px" ViewStateStorage="None" DataTextField="ContactName"
       DataValueField="CustomerID" DataMember="Customers" 
       BindingOperationMode="ClientBinding">
          <FlyPostBackSettings PostHiddenFields="true" PostInputControls="true" />
          <ClientBindingSettings DataSourceType="AdoDataService" 
             ServiceUrl="NorthwindDataService.svc" />
    </ISWebCombo:WebCombo>

  17. Run the project and the WebCombo should look like following.

Previous Next