This walkthrough shows you how to configure client binding using WebService mode in WebCombo.
During this walkthrough, you will learn how to do the following:
- Create WebService
- Bind WebService into WebCombo
In order to complete this walkthrough, you will need the following:
- Northwind.mdf.
- Visual Studio 2008/2010 Application.
To configure client binding using WebService mode
- Launch Visual Studio.NET 2010.
- Click on File menu, then select New and click Web Site.
- Select ASP.NET Web Site in the Template box.
- Named the Web Site and click OK.
- In the Solution Explorer, right-click on App_Data and select Add Existing Item.
- Browse and add NorthWind.mdf in C:\Program Files\Intersoft Solutions\Data (Default installation folder).
- Add new page in App_Code and select Linq to Sql classes template. Named it Northwind.dbml.
- Drag Table Customer in Northwind.mdf from Server Explorer.
- Right-click on Project's name and select Add New Item.
- Select Intersoft AppForm in the My Templates box and named it as Walkthrough.aspx.
- Create WebService.asmx in the same level with your aspx name.
- Go to App_Code and add method GetCustomers in WebService.cs.
C# |
Copy Code |
using ISNet.ClientServices;
using ISNet.Data.Linq;
[System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{
[WebMethod]
public QueryResult GetCustomers(DataSourceSelectArguments selectArguments)
{
NorthwindDataContext context = new NorthwindDataContext();
context.DeferredLoadingEnabled = false;
context.ObjectTrackingEnabled = false;
WebComboDataProvider<Customer> query =
new WebComboDataProvider<Customer>(context.Customers);
return query.Select(selectArguments);
}
} |
- Drag WebCombo instance from Toolbox to WebForm.
- Set the properties based on the table and code below.
BindingOperationMode |
ClientBinding |
DataSourceType |
WebService |
ServiceUrl |
WebService.asmx (or any .asmx file created by user) |
SelectMethod |
GetCustomers |
HTML |
Copy Code |
<ISWebCombo:WebCombo ID="wcSupplier" runat="server" Width="150px"
DataTextField="ContactName" DataValueField="CustomerID" Height="20px"
UseDefaultStyle="True" BindingOperationMode="ClientBinding">
<ClientBindingSettings DataSourceType="WebService" ServiceUrl="WebService.asmx">
<ServiceMethods SelectMethod="GetCustomers" />
</ClientBindingSettings>
</ISWebCombo:WebCombo> |
- Save all the pages. Browse WebService.asmx to ensure that the service works then run Walkthrough.aspx.