Menu for ASP.NET Web Forms
Saving and Loading a C1Menu from XML
Task-Based Help > Saving and Loading a C1Menu from XML

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

Save the C1Menu as XML

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

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

Load an Existing XML C1Menu into your Project

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

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

Load an Existing XML C1Menu in Code

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

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

    To write code in Visual Basic

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

    To write code in C#

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