This walkthrough shows you how to create and bind WebCombo to a DataSet.
During this walkthrough, you will learn how to do the following:
- Connect to a Microsoft Access database using Microsoft Jet 4.0 OLE DB Provider.
- Use OleDbDataAdapter to configure SQL Query and generate DataSet.
- Set Web Application's environment and the DataSource.
- Use WebCombo's InitializeDataSource event to bind the DataSet.
Prerequisites
In order to complete this walkthrough, you will need the following:
- Access to the Microsoft Access Northwind database.
- Visual Studio 2005/2008/2010 Application.
Step-By-Step Instructions
To create new web application and bind WebCombo with DataSource
- Launch Visual Studio.NET 2005.
- Click on File menu, then select New and click Web Site.
- Select ASP.NET Web Site in the Template box and set Location to HTTP.
- Named the Web Site and click OK.
- 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.
- Drag WebCombo instance from ToolBar to WebForm.
- Double click on WebCombo instance and write this code:
C# Copy Code protected void WebCombo1_InitializeDataSource(object sender, ISNet.WebUI.WebCombo.DataSourceEventArgs e) { DataSet1TableAdapters.ProductsTableAdapter da = new DataSet1TableAdapters.ProductsTableAdapter(); e.DataSource = da.GetData(); WebCombo1.DataTextField = "ProductName"; WebCombo1.DataValueField = "ProductID"; }
- Run the project and the combo will look like following.
Tasks
Walkthrough: Binding WebCombo to AccessDataSource control
Walkthrough: Binding WebCombo to ObjectDataSource control
Walkthrough: Binding WebCombo to ISDataSource control
Walkthrough: Binding WebCombo to SqlDataSource control
Walkthrough: Binding WebCombo to XMLDataSource control
Walkthrough: Binding WebCombo to IList DataSource control
Walkthrough: Binding WebCombo to custom object
Concepts
No-codes data binding through DataSourceControl support
References
DataSource Property
DataTextField Property
DataValueField Property
InitializeDataSource Event
OnInitializeDataSource Method