Intersoft Support Center

Bind to XML DataSource

This walkthrough shows you how to create and bind WebGrid to a XMLDataSource control.

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

  • Use XMLDataSource.
  • Use SmartTag to set DataSource.
  • Use DataSourceConfigurationWizard to set the Database and table.

 Prerequisites

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

  • Access to the XML database.
  • Visual Studio 2005/2008/2010 Application.

 Step-By-Step Instructions

To create new web Website and bind WebGrid to XMLDataSource

  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 instance from ToolBar to WebForm.
  8. Browse and add SamplesData.xml in C:\Program Files\Intersoft Solutions\Intersoft WebUI Studio 2010 R1\Samples\For ASP.NET\ISNet.WebUI.Samples\cs\WebGrid (Default installation folder).
  9. Click the SmartTag on the upper right of the WebGrid.
  10. In Choose Data Source field, choose <New data source...>.



  11. In Data Source Configuration Wizard, choose XML File and click OK.



  12. Set the Data File and XPath expression then click OK.
    Data File is used to locate the xml file needed in the project. XPath Expression allows you to filter the data in XML and returns only a subset of the file.


  13. Finally, choose Retrieve Structure action in Connected to XMLData Source Control Wizard and clik OK.
    When you select "Configure this WebGrid to act as TreeView", WebGrid will be rendered as TreeView. When you deselect the option, WebGrid will be rendered as a normal grid.


  14. Run the project and the WebGrid will look like following.



Previous Next