Step 1: Add an XML Data Source Component
To create an XML file, add the XMLDataSource component to the Web site, and then assign it to the C1WebTreeView control, complete the following steps:
1. Start a new Web Site project.
2. Right-click on the project in the Solution Explorer and select Add New Item. The Add New Item dialog box appears.
3. Rename the XMLFile.xml to data.xml. Click Add to add the new data.xml file to the project.
4. Switch to the XML view and add the following data to the data.xml file:
<?xml version="1.0" encoding="utf-8" ?>
<books>
<languagebooks>
<book title="Pure JavaScript" author="Wyke, Gilliam, and Ting"/>
<book title="Effective C++: 50 Specific Ways to Improve Your Programs and Designs" author="Scott Meyers"/>
<book title="Assembly Language: Step-By-Step" author="Jeff Duntemann"/>
<book title="Oracle PL/SQL Best Practices" author="Steven Feuerstein"/>
</languagebooks>
<securitybooks>
<book Title="Counter Hack: A Step-by-Step Guide to Computer Attacks and Effective Defenses" author="Ed Skoudis"/>
</securitybooks>
</books>
5. Switch back to the .aspx page and select the Design tab to switch to Design view.
6. Select the Data tab in the Visual Studio Toolbox and add the XmlDataSource component to the Web page using a drag-and-drop operation.
7. Right-click the XmlDataSource1 control and select Properties from its context menu. In its Properties window set the XmlDataSource1.DataFile property to data.xml.
8. Add a C1WebTreeView control to the Web form. Select XMLDataSource1 value from the Choose Data Source drop-down box.
The XMLDataSource1 appears in the C1WebTreeView's DataSourceID property.
|