Intersoft Support Center

Bind to LinQ

This walkthrough will guide you to bind the WebGrid control to ISLinqDataSource.

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

  • Configure DataSource using ISLinqDataSource SmartTag.

 Prerequisites

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

  • Visual Studio 2008/2010 Application.
  • Microsoft.NET Framework 3.5.

 Step-By-Step Instructions

To create new web Website and bind WebGrid to ISLinqDataSource

  1. Launch Visual Studio.NET 2008.
  2. Click on File menu, then select New and click Web Site.
  3. Select ASP.NET Web Site in the Template box and set Location to HTTP.
  4. Named the Web Site and click OK.
  5. Right-click on Project's name and select Add New Item.
  6. Select Intersoft AppForm in the My Templates box and named it as Walkthrough.aspx.
  7. Drag WebGrid from toolbox to the WebForm.
  8. Drag ISLinqDataSource to the designer surface. If you can’t find ISLinqDataSource, please download ISLinqDataSource and save the assembly to [Program Files]\Intersoft Solutions\WebUI Studio for ASP.NET\WebGrid.NET 7.0\Bin. Then add it to Visual Studio toolbox by right clicking on the toolbox area and click Choose Items.
  9. Click Configure Datasource from the ISLinqDataSource SmartTag. See below.
  10. The LinqDataSource Wizard is pretty simple and straightforward. On the first screen, it should already select NorthwindDataContext by default, so simply click Next.
  11. On the second screen, since we want to select all customer properties, we don’t need to configure anything else, simply click Finish. See below.



  12. Select WebGrid instance and open its SmartTag. Choose ISLinqDataSource1 as the DataSourceID, and the WebGrid wizard will appear such as shown below.



  13. Simply click OK as we want the WebGrid to retrieve the columns structure from the ISLinqDataSource.
  14. You’re all set. Save the WebForm, and run the page in the browser.
  15. You have successfully bound a WebGrid control to LINQ-enabled datasource. Your browser should look like the image below.

Previous Next