First, create an xml file named menu with the following content: First, create an xml file named menu with the following content:
Then, drag and drop a menu control on the page, and drag and drop an XmlDataSource control. The id is xmlperformance1, and the menu performanceid is set to xmlperformance1.
Configure the XmlDataSource control to make DataFile = "~ /Menu. xml "XPath =" menu/menuItem ",
Here, we use xpath to select data, which filters out menuItem data.
Then, bind the data of the menu control to tell the menu control how to display the data filtered out from the xml file. Select the menu control and DataBindings in the properties window. in the displayed dialog box, select menuItem in the list in the upper left corner and click add to add menuItem to the list in the lower left corner, then select menuItem in this list. the right list displays the attributes to be bound so that NavigateUrlField = "url" TextField = "title ". Press the OK button to return to the design interface. The "homepage" and "news" menu items are displayed.
The html code is as follows:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CoAffiliate._Default" %> Untitled Page
The above is the use of xml as the data source, with asp: Menu class free expansion Menu item content, more relevant content please follow PHP Chinese network (www.php1.cn )!