ComponentOne TreeView for ASP.NET WebForms
Task-Based Help / Saving and Loading a C1TreeView from XML
In This Topic
    Saving and Loading a C1TreeView from XML
    In This Topic

    The following tasks show you how to save your C1TreeView control as an .xml file and then load it into your project using the designer.

    Save the C1TreeView as XML

    To save your tree as an XML file using the designer:

    1. Click C1TreeView's smart tag and select Edit TreeView to open the  C1TreeView Designer Form.
    2. Navigate to File | Save as XML.
    3. Name the .xml file for your C1TreeView and browse to where you would like to save it.
    4. Click OK to close the TreeView Designer Form dialog box.

    Load an Existing XML C1TreeView into your Project

    To load the C1TreeView control you saved as an .xml file into your project:

    1. Click C1TreeView's smart tag and select Edit TreeView to open the  C1TreeView Designer Form.
    2. Open the C1TreeView Designer Form.
    3. Navigate to File | Load From XML and click open to open the existing .xml file.

    Load an Existing XML C1TreeView in Code

    To load the C1TreeView control you saved as an .xml file into your project:

    1. Create an XML file for the C1TreeView structure.
    2. Call the LoadLayout method to load the items, passing in the path to the file:

      To write the code in Visual Basic:

      Visual Basic
      Copy Code
      C1TreeView1.LoadLayout("c:\\Visual Studio 2005\\WebSites\\LoadLayoutEX\\App_Data\\C1TreeViewControl.xml")

      To write the code in C#:

      C#
      Copy Code
      C1TreeView1.LoadLayout("c:\\Visual Studio 2005\\WebSites\\LoadLayoutEX\\App_Data\\C1TreeViewControl.xml");
    3. Press F5 to run the program.
    See Also