ComponentOne WebMenus and WebBars for ASP.NET: Data Binding Tutorials > Bind to a Data Source Using the Data Source Configuration Wizard

Bind to a Data Source Using the Data Source Configuration Wizard

You can easily bind C1WebMenu, C1WebToolBar, C1WebTreeView, C1WebTopicBar, or C1WebTabStrip to a data source using the Data Source Configuration Wizard in Visual Studio.

There are two ways to access the wizard, either through the DataSourceID property in the controls' Properties window or the Choose Data Source box in C1WebCommand2 controls'  Tasks menu. For more information on the Tasks menus for C1WebCommand2 controls, , see C1WebCommand2 Smart Tags.

Clicking on the Choose Data Source drop-down arrow in the Tasks menu or the drop-down arrow next to the DataSourceID property in the properties window allows you to select an existing data source or create a new data source type.

To add a data source to your project, click New Data Source to open the Data Source Configuration Wizard.

The Data Source Configuration Wizard walks you through adding a data source step by step. You can choose from the following two data source types in the Data Source Configuration Wizard: SiteMap and XML File.

To connect to the Site Map application:

The Site Map connects to the site navigation tree for this application. This requires a valid site map file at the application root.

1.   Select the Site Map application from the Choose a Data Source Type.

The wizard adds a SiteMapDataSource ID to the text box.

2.   Click OK.

A Root Node and a SiteMapDataSource are added to the C1WebMenu component.

For more information about binding a SiteMapDataSource control to a WebMenu or WebTreeView control, see Bind to a Site Map.

To connect to the XML File application:

The XML file application connects to an XML file.

1.   Select the XML File application from the Choose a Data Source Type.

The wizard adds an XMLDataSource ID to the text box. On this page you can specify an ID for the data source or use the default name provided by the wizard.

2.   Click OK.

The Configure Data Source dialog appears.

The Configure Data Source dialog box provides a Data file, Transform file, and an Xpath expression to add a XML data file, transform and/or filter the data in the XML file.

3.   To add a XML file click the Browse button next to the Data file text box, then double-click the App_Data item from the Project folders list box. The xml file appears in the Contents of folder list box.

4.   Click OK.

The wizard adds the data.xml file to the XmlDataSource1 ID.

5.   Click OK.

The Configure loads the configuration file into memory, parses the contents and calls the methods to register the channels and objects described in the data.xml file. The wizard creates the channels and XmlDataSource, and adds them to the C1WebMenu control.

For more information on how to set up the elements in the Bindings Collection Editor, see Bind C1WebTreeView to an XML File.


Send comments about this topic to ComponentOne.
Copyright © 1987-2009 ComponentOne LLC. All rights reserved.