ComponentOne Menu for ASP.NET AJAX: Menu for ASP.NET Task-Based Help > Saving and Loading C1Menu as an XML File > Load C1Menu from an XML File

Load C1Menu from an XML File

You can load menu items from an XML source using the designer or programmatically through the LoadLayout method.

To populate a C1Menu object from an XML source using the designer:

1.   Create an ASP.NET AJAX-Enabled Web Site.

2.   Add the C1Menu control to the page.

3.   Right-click the C1Menu control and select MenuDesignerForm.

The MenuDesignerForm appears.

4.   Select File | Load from XML.

 

 

5.   Browse to the location of the save XML menu file.

6.   Click Open and the C1Menu content items appear in the C1Menu Designer Form pane.

To load a C1Menu object from an XML source programmatically using the LoadLayout (string):

1.   Add C1Menu to the page.

2.   Create an XML file for the C1Menu structure.

3.   Call the LoadLayout method to load the items, passing in the path to the file:

      Visual Basic

C1Menu1.LoadLayout("c:\\Visual Studio 2005\\WebSites\\LoadLayoutEX\\App_Data\\C1Menu.xml")

      C#

C1Menu1.LoadLayout("c:\\Visual Studio 2005\\WebSites\\LoadLayoutEX\\App_Data\\C1Menu.xml");

You can also populate C1MenuItems using an XMLDataSource component. For an example of how to bind C1Menu to an XMLDataSource see, Applying Different Data Binding Methods.


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